Exemplo n.º 1
0
bool KstViewLabel::readConfigWidget(QWidget *w) {
  ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w);
  if (!widget) {
    return false;
  }

  _txt = widget->_text->text();
  // No, this is broken.  It kills latex.
#if 0
  // Replace tabs and newlines in text edit box with \n and \t 
  _txt.replace(QString("\n"), "\\n");
  _txt.replace(QString("\t"), "\\t");
#endif

  setDataPrecision(widget->_precision->value());
  setRotation(widget->_rotation->value());
  setFontSize(widget->_fontSize->value());
  setHorizJustifyWrap(widget->_horizontal->currentItem());
  setForegroundColor(widget->_fontColor->color());
  setFontName(widget->_font->currentFont().toString());

  setTransparent(widget->_transparent->isChecked());
  setBorderWidth(widget->_border->value());
  setBorderColor(widget->_boxColors->color());
  setBackgroundColor(widget->_boxColors->color());
  setLabelMargin(widget->_margin->value());
 
  reparse(); // calls setDirty()
  return true;
}
bool KstViewLabel::readConfigWidget(QWidget *w, bool editMultipleMode) {
  ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w);
  if (!widget) {
    return false;
  }

  if (!editMultipleMode || widget->_text->text().compare(QString(" ")) != 0) {
    _txt = widget->_text->text();
  }

  if (!editMultipleMode || widget->_precision->value() != widget->_precision->minValue()) {
    setDataPrecision(widget->_precision->value());
  }

  if (!editMultipleMode || widget->_rotation->value() != widget->_rotation->minValue()) {
    setRotation(widget->_rotation->value());
  }

  if (!editMultipleMode || widget->_fontSize->value() != widget->_fontSize->minValue()) {
    setFontSize(widget->_fontSize->value());
  }

  if (!editMultipleMode || widget->_horizontal->currentText().compare(QString(" ")) != 0) {
    setHorizJustifyWrap(widget->_horizontal->currentItem());
  }

  if (!editMultipleMode || widget->_fontColor->color() != QColor()) {
    setForegroundColor(widget->_fontColor->color());
  }

  if (!editMultipleMode || widget->_font->currentText().compare(QString(" ")) != 0) {
    setFontName(widget->_font->currentFont());
  }

  if (!editMultipleMode || widget->_transparent->state() != QButton::NoChange) {
    setTransparent(widget->_transparent->isChecked());
  }

  if (!editMultipleMode || widget->_border->value() != widget->_border->minValue()) {
    setBorderWidth(widget->_border->value());
  }

  if (!editMultipleMode || widget->_changedFgColor) {
    setBorderColor(widget->_boxColors->foreground());
  }

  if (!editMultipleMode || widget->_changedBgColor) {
    setBackgroundColor(widget->_boxColors->background());
  }

  if (!editMultipleMode || widget->_margin->value() != widget->_margin->minValue()) {
    setLabelMargin(widget->_margin->value());
  }

  reparse(); // calls setDirty()
  return true;
}