bool KstViewLabel::fillConfigWidget(QWidget *w, bool isNew) const { ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w); if (!widget) { return false; } if (!isNew) { widget->_text->setText(text()); } widget->_precision->setValue(int(dataPrecision())); widget->_rotation->setValue(double(rotation())); widget->_fontSize->setValue(int(fontSize())); widget->_horizontal->setCurrentItem(horizJustifyWrap()); widget->_fontColor->setColor(foregroundColor()); widget->_font->setCurrentFont(fontName()); widget->_transparent->setChecked(transparent()); widget->_border->setValue(borderWidth()); widget->_boxColors->setForeground(borderColor()); widget->_boxColors->setBackground(backgroundColor()); widget->_margin->setValue(labelMargin()); widget->_text->setFocus(); return true; }
bool KstViewLabel::fillConfigWidget(QWidget *w, bool isNew) const { ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w); if (!widget) { return false; } if (isNew) { // probably a new label: set widget to defaults widget->_precision->setValue(8); widget->_rotation->setValue(0); widget->_fontSize->setValue(0); widget->_horizontal->setCurrentItem(0); widget->_fontColor->setColor(KstSettings::globalSettings()->foregroundColor); widget->_font->setCurrentFont(KstApp::inst()->defaultFont()); widget->_margin->setValue(5); widget->_boxColors->setColor(KstSettings::globalSettings()->backgroundColor); if (size().width() * size().height() < 25) { // assume a click, and default to just text widget->_transparent->setChecked(true); widget->_border->setValue(0); } else { // someone drew a box, so assume that is what they wanted widget->_transparent->setChecked(false); widget->_border->setValue(2); } } else { // No, this is broken. It kills latex. #if 0 // replace \n & \t with tabs and newlines for the text edit box QString tmpstr = text(); tmpstr.replace(QString("\\n"), "\n"); tmpstr.replace(QString("\\t"), "\t"); widget->_text->setText(tmpstr); #endif widget->_text->setText(text()); widget->_precision->setValue(int(dataPrecision())); widget->_rotation->setValue(double(rotation())); widget->_fontSize->setValue(int(fontSize())); widget->_horizontal->setCurrentIndex(horizJustifyWrap()); widget->_fontColor->setColor(foregroundColor()); widget->_font->setCurrentFont(fontName()); widget->_transparent->setChecked(transparent()); widget->_border->setValue(borderWidth()); widget->_boxColors->setColor(borderColor()); widget->_margin->setValue(_labelMargin); } widget->_text->setFocus(); return true; }