void RelationalField::setfontColor(QColor arg) { if (m_fontColor != arg) { m_fontColor = arg; emit fontColorChanged(arg); } }
// see legacy/LabelWidget.cpp LabelWidget::LabelWidget(QWidget *parent): QWidget(parent), m_initializing(false), m_dateTimeMenu(new KMenu(this)) { ui.setupUi(this); m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the first separator to be removed QGridLayout* layout =static_cast<QGridLayout*>(this->layout()); layout->setContentsMargins(2,2,2,2); layout->setHorizontalSpacing(2); layout->setVerticalSpacing(2); ui.kcbFontColor->setColor(Qt::black); // default color //Icons ui.tbFontBold->setIcon( KIcon("format-text-bold") ); ui.tbFontItalic->setIcon( KIcon("format-text-italic") ); ui.tbFontUnderline->setIcon( KIcon("format-text-underline") ); ui.tbFontStrikeOut->setIcon( KIcon("format-text-strikethrough") ); ui.tbFontSuperScript->setIcon( KIcon("format-text-superscript") ); ui.tbFontSubScript->setIcon( KIcon("format-text-subscript") ); ui.tbSymbols->setIcon( KIcon("labplot-format-text-symbol") ); ui.tbDateTime->setIcon( KIcon("chronometer") ); ui.tbTexUsed->setIconSize(QSize(20, 20)); ui.tbTexUsed->setIcon( KIcon("labplot-TeX-logo") ); //Positioning and alignment ui.cbPositionX->addItem(i18n("left")); ui.cbPositionX->addItem(i18n("center")); ui.cbPositionX->addItem(i18n("right")); ui.cbPositionX->addItem(i18n("custom")); ui.cbPositionY->addItem(i18n("top")); ui.cbPositionY->addItem(i18n("center")); ui.cbPositionY->addItem(i18n("bottom")); ui.cbPositionY->addItem(i18n("custom")); ui.cbHorizontalAlignment->addItem(i18n("left")); ui.cbHorizontalAlignment->addItem(i18n("center")); ui.cbHorizontalAlignment->addItem(i18n("right")); ui.cbVerticalAlignment->addItem(i18n("top")); ui.cbVerticalAlignment->addItem(i18n("center")); ui.cbVerticalAlignment->addItem(i18n("bottom")); //SLOTS // text properties connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged(bool)) ); connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged())); connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(charFormatChanged(QTextCharFormat))); connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColorChanged(QColor))); connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(bool))); connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicChanged(bool))); connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnderlineChanged(bool))); connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStrikeOutChanged(bool))); connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSuperScriptChanged(bool))); connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubScriptChanged(bool))); connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu())); connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu())); connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertDateTime(QAction*)) ); connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fontChanged(QFont))); connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(int)) ); // geometry connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(positionXChanged(int)) ); connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(positionYChanged(int)) ); connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(customPositionXChanged(double)) ); connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(customPositionYChanged(double)) ); connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(horizontalAlignmentChanged(int)) ); connect( ui.cbVerticalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(verticalAlignmentChanged(int)) ); connect( ui.sbRotation, SIGNAL(valueChanged(int)), this, SLOT(rotationChanged(int)) ); connect( ui.sbOffsetX, SIGNAL(valueChanged(double)), this, SLOT(offsetXChanged(double)) ); connect( ui.sbOffsetY, SIGNAL(valueChanged(double)), this, SLOT(offsetYChanged(double)) ); connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); //TODO: https://bugreports.qt.io/browse/QTBUG-25420 ui.tbFontUnderline->hide(); ui.tbFontStrikeOut->hide(); }
/*! \class LabelWidget \brief Widget for editing the properties of a TextLabel object, mostly used in an appropriate dock widget. In order the properties of the label to be shown, \c loadConfig() has to be called with the correspondig KConfigGroup (settings for a label in *Plot, Axis etc. or for an independent label on the worksheet). \ingroup kdefrontend */ LabelWidget::LabelWidget(QWidget* parent) : QWidget(parent), m_label(0), m_initializing(false), m_dateTimeMenu(new QMenu(this)), m_teXEnabled(false) { // see legacy/LabelWidget.cpp ui.setupUi(this); QSplitter* splitter = new QSplitter(Qt::Vertical, this); splitter->setHandleWidth(1); splitter->addWidget(ui.frameTop); splitter->addWidget(ui.frameBottom); splitter->setChildrenCollapsible(false); ui.lText->setMinimumWidth(ui.lGeometry->width()); this->layout()->addWidget(splitter); m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the first separator to be removed ui.kcbFontColor->setColor(Qt::black); // default color //Icons ui.tbFontBold->setIcon( QIcon::fromTheme("format-text-bold") ); ui.tbFontItalic->setIcon( QIcon::fromTheme("format-text-italic") ); ui.tbFontUnderline->setIcon( QIcon::fromTheme("format-text-underline") ); ui.tbFontStrikeOut->setIcon( QIcon::fromTheme("format-text-strikethrough") ); ui.tbFontSuperScript->setIcon( QIcon::fromTheme("format-text-superscript") ); ui.tbFontSubScript->setIcon( QIcon::fromTheme("format-text-subscript") ); ui.tbSymbols->setIcon( QIcon::fromTheme("labplot-format-text-symbol") ); ui.tbDateTime->setIcon( QIcon::fromTheme("chronometer") ); ui.tbTexUsed->setIcon( QIcon::fromTheme("labplot-TeX-logo") ); //Positioning and alignment ui.cbPositionX->addItem(i18n("left")); ui.cbPositionX->addItem(i18n("center")); ui.cbPositionX->addItem(i18n("right")); ui.cbPositionX->addItem(i18n("custom")); ui.cbPositionY->addItem(i18n("top")); ui.cbPositionY->addItem(i18n("center")); ui.cbPositionY->addItem(i18n("bottom")); ui.cbPositionY->addItem(i18n("custom")); ui.cbHorizontalAlignment->addItem(i18n("left")); ui.cbHorizontalAlignment->addItem(i18n("center")); ui.cbHorizontalAlignment->addItem(i18n("right")); ui.cbVerticalAlignment->addItem(i18n("top")); ui.cbVerticalAlignment->addItem(i18n("center")); ui.cbVerticalAlignment->addItem(i18n("bottom")); //check whether the used latex compiler is available. //Following logic is implemented (s.a. LabelWidget::teXUsedChanged()): //1. in case latex was used to generate the text label in the stored project //and no latex is available on the target system, latex button is toggled and //the user still can switch to the non-latex mode. //2. in case the label was in the non-latex mode and no latex is available, //deactivate the latex button so the user cannot switch to this mode. m_teXEnabled = TeXRenderer::enabled(); #ifdef HAVE_KF5_SYNTAX_HIGHLIGHTING m_highlighter = new KSyntaxHighlighting::SyntaxHighlighter(ui.teLabel->document()); m_highlighter->setDefinition(m_repository.definitionForName("LaTeX")); #endif //SLOTS // text properties connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged(bool)) ); connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged())); connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(charFormatChanged(QTextCharFormat))); connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColorChanged(QColor))); connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(bool))); connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicChanged(bool))); connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnderlineChanged(bool))); connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStrikeOutChanged(bool))); connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSuperScriptChanged(bool))); connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubScriptChanged(bool))); connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu())); connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu())); connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertDateTime(QAction*)) ); connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fontChanged(QFont))); connect(ui.kfontRequesterTeX, SIGNAL(fontSelected(QFont)), this, SLOT(teXFontChanged(QFont))); connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(int)) ); // geometry connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(positionXChanged(int)) ); connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(positionYChanged(int)) ); connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(customPositionXChanged(double)) ); connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(customPositionYChanged(double)) ); connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(horizontalAlignmentChanged(int)) ); connect( ui.cbVerticalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(verticalAlignmentChanged(int)) ); connect( ui.sbRotation, SIGNAL(valueChanged(int)), this, SLOT(rotationChanged(int)) ); connect( ui.sbOffsetX, SIGNAL(valueChanged(double)), this, SLOT(offsetXChanged(double)) ); connect( ui.sbOffsetY, SIGNAL(valueChanged(double)), this, SLOT(offsetYChanged(double)) ); connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); //TODO: https://bugreports.qt.io/browse/QTBUG-25420 ui.tbFontUnderline->hide(); ui.tbFontStrikeOut->hide(); }
/*! \class LabelWidget \brief Widget for editing the properties of a TextLabel object, mostly used in an an appropriate dock widget. In order the properties of the label to be shown, \c loadConfig() has to be called with the correspondig KConfigGroup (settings for a label in *Plot, Axis etc. or for an independent label on the worksheet). \ingroup kdefrontend */ LabelWidget::LabelWidget(QWidget* parent) : QWidget(parent), m_initializing(false), m_dateTimeMenu(new KMenu(this)), m_teXEnabled(false) { ui.setupUi(this); m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the first separator to be removed QGridLayout* layout = static_cast<QGridLayout*>(this->layout()); layout->setContentsMargins(2,2,2,2); layout->setHorizontalSpacing(2); layout->setVerticalSpacing(2); ui.kcbFontColor->setColor(Qt::black); // default color //Icons ui.tbFontBold->setIcon( KIcon("format-text-bold") ); ui.tbFontItalic->setIcon( KIcon("format-text-italic") ); ui.tbFontUnderline->setIcon( KIcon("format-text-underline") ); ui.tbFontStrikeOut->setIcon( KIcon("format-text-strikethrough") ); ui.tbFontSuperScript->setIcon( KIcon("format-text-superscript") ); ui.tbFontSubScript->setIcon( KIcon("format-text-subscript") ); ui.tbSymbols->setIcon( KIcon("labplot-format-text-symbol") ); ui.tbDateTime->setIcon( KIcon("chronometer") ); ui.tbTexUsed->setIconSize(QSize(20, 20)); ui.tbTexUsed->setIcon( KIcon("labplot-TeX-logo") ); //Positioning and alignment ui.cbPositionX->addItem(i18n("left")); ui.cbPositionX->addItem(i18n("center")); ui.cbPositionX->addItem(i18n("right")); ui.cbPositionX->addItem(i18n("custom")); ui.cbPositionY->addItem(i18n("top")); ui.cbPositionY->addItem(i18n("center")); ui.cbPositionY->addItem(i18n("bottom")); ui.cbPositionY->addItem(i18n("custom")); ui.cbHorizontalAlignment->addItem(i18n("left")); ui.cbHorizontalAlignment->addItem(i18n("center")); ui.cbHorizontalAlignment->addItem(i18n("right")); ui.cbVerticalAlignment->addItem(i18n("top")); ui.cbVerticalAlignment->addItem(i18n("center")); ui.cbVerticalAlignment->addItem(i18n("bottom")); //check whether the used latex compiler is available. //Following logic is implemented (s.a. LabelWidget::teXUsedChanged()): //1. in case latex was used to generate the text label in the stored project //and no latex is available on the target system, latex button is toggled and //the user still can switch to the non-latex mode. //2. in case the label was in the non-latex mode and no latex is available, //deactivate the latex button so the user cannot switch to this mode. m_teXEnabled = TeXRenderer::enabled(); //SLOTS // text properties connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged(bool)) ); connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged())); connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(charFormatChanged(QTextCharFormat))); connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColorChanged(QColor))); connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(bool))); connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicChanged(bool))); connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnderlineChanged(bool))); connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStrikeOutChanged(bool))); connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSuperScriptChanged(bool))); connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubScriptChanged(bool))); connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu())); connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu())); connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertDateTime(QAction*)) ); connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fontChanged(QFont))); connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(int)) ); // geometry connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(positionXChanged(int)) ); connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(positionYChanged(int)) ); connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(customPositionXChanged(double)) ); connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(customPositionYChanged(double)) ); connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(horizontalAlignmentChanged(int)) ); connect( ui.cbVerticalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(verticalAlignmentChanged(int)) ); connect( ui.sbRotation, SIGNAL(valueChanged(int)), this, SLOT(rotationChanged(int)) ); connect( ui.sbOffsetX, SIGNAL(valueChanged(double)), this, SLOT(offsetXChanged(double)) ); connect( ui.sbOffsetY, SIGNAL(valueChanged(double)), this, SLOT(offsetYChanged(double)) ); connect( ui.chbVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); //TODO: https://bugreports.qt.io/browse/QTBUG-25420 ui.tbFontUnderline->hide(); ui.tbFontStrikeOut->hide(); }