void QFontDialogPrivate::initHelper(QPlatformDialogHelper *h) { QFontDialog *d = q_func(); QObject::connect(h, SIGNAL(currentFontChanged(QFont)), d, SIGNAL(currentFontChanged(QFont))); QObject::connect(h, SIGNAL(fontSelected(QFont)), d, SIGNAL(fontSelected(QFont))); static_cast<QPlatformFontDialogHelper *>(h)->setOptions(options); }
QFontDialogHelper() : QPlatformFontDialogHelper() { connect(&m_dialog, SIGNAL(currentFontChanged(QFont)), this, SIGNAL(currentFontChanged(QFont))); connect(&m_dialog, SIGNAL(fontSelected(QFont)), this, SIGNAL(fontSelected(QFont))); connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept())); connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject())); }
void KConfigDialogManager::initMaps() { if (s_propertyMap()->isEmpty()) { s_propertyMap()->insert(QStringLiteral("KButtonGroup"), "current"); s_propertyMap()->insert(QStringLiteral("KColorButton"), "color"); s_propertyMap()->insert(QStringLiteral("KColorCombo"), "color"); //s_propertyMap()->insert( "KUrlRequester", "url" ); //s_propertyMap()->insert( "KUrlComboRequester", "url" ); } if (s_changedMap()->isEmpty()) { // QT s_changedMap()->insert(QStringLiteral("QCheckBox"), SIGNAL(stateChanged(int))); s_changedMap()->insert(QStringLiteral("QPushButton"), SIGNAL(clicked(bool))); s_changedMap()->insert(QStringLiteral("QRadioButton"), SIGNAL(toggled(bool))); // We can only store one thing, so you can't have // a ButtonGroup that is checkable. // s_changedMap()->insert("QButtonGroup", SIGNAL(buttonClicked(int))); s_changedMap()->insert(QStringLiteral("QGroupBox"), SIGNAL(toggled(bool))); s_changedMap()->insert(QStringLiteral("QComboBox"), SIGNAL(activated(int))); //qsqlproperty map doesn't store the text, but the value! //s_changedMap()->insert("QComboBox", SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("QDateEdit"), SIGNAL(dateChanged(QDate))); s_changedMap()->insert(QStringLiteral("QTimeEdit"), SIGNAL(timeChanged(QTime))); s_changedMap()->insert(QStringLiteral("QDateTimeEdit"), SIGNAL(dateTimeChanged(QDateTime))); s_changedMap()->insert(QStringLiteral("QDial"), SIGNAL(valueChanged(int))); s_changedMap()->insert(QStringLiteral("QDoubleSpinBox"), SIGNAL(valueChanged(double))); s_changedMap()->insert(QStringLiteral("QLineEdit"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("QSlider"), SIGNAL(valueChanged(int))); s_changedMap()->insert(QStringLiteral("QSpinBox"), SIGNAL(valueChanged(int))); s_changedMap()->insert(QStringLiteral("QTextEdit"), SIGNAL(textChanged())); s_changedMap()->insert(QStringLiteral("QTextBrowser"), SIGNAL(sourceChanged(QString))); s_changedMap()->insert(QStringLiteral("QPlainTextEdit"), SIGNAL(textChanged())); s_changedMap()->insert(QStringLiteral("QTabWidget"), SIGNAL(currentChanged(int))); // KDE s_changedMap()->insert(QStringLiteral("KComboBox"), SIGNAL(activated(int))); s_changedMap()->insert(QStringLiteral("KFontComboBox"), SIGNAL(activated(int))); s_changedMap()->insert(QStringLiteral("KFontRequester"), SIGNAL(fontSelected(QFont))); s_changedMap()->insert(QStringLiteral("KFontChooser"), SIGNAL(fontSelected(QFont))); s_changedMap()->insert(QStringLiteral("KHistoryCombo"), SIGNAL(activated(int))); s_changedMap()->insert(QStringLiteral("KColorCombo"), SIGNAL(activated(QColor))); s_changedMap()->insert(QStringLiteral("KColorButton"), SIGNAL(changed(QColor))); s_changedMap()->insert(QStringLiteral("KDatePicker"), SIGNAL(dateSelected(QDate))); s_changedMap()->insert(QStringLiteral("KDateWidget"), SIGNAL(changed(QDate))); s_changedMap()->insert(QStringLiteral("KDateTimeWidget"), SIGNAL(valueChanged(QDateTime))); s_changedMap()->insert(QStringLiteral("KEditListWidget"), SIGNAL(changed())); s_changedMap()->insert(QStringLiteral("KListWidget"), SIGNAL(itemSelectionChanged())); s_changedMap()->insert(QStringLiteral("KLineEdit"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("KPasswordEdit"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("KRestrictedLine"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("KTextEdit"), SIGNAL(textChanged())); s_changedMap()->insert(QStringLiteral("KUrlRequester"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("KUrlComboRequester"), SIGNAL(textChanged(QString))); s_changedMap()->insert(QStringLiteral("KUrlComboBox"), SIGNAL(urlActivated(QUrl))); s_changedMap()->insert(QStringLiteral("KButtonGroup"), SIGNAL(changed(int))); }
/*! \since 4.5 \overload Opens the dialog and connects its fontSelected() signal to the slot specified by \a receiver and \a member. The signal will be disconnected from the slot when the dialog is closed. */ void QFontDialog::open(QObject *receiver, const char *member) { Q_D(QFontDialog); connect(this, SIGNAL(fontSelected(QFont)), receiver, member); d->receiverToDisconnectOnClose = receiver; d->memberToDisconnectOnClose = member; QDialog::open(); }
void KFontRequester::setFont(const QFont &font, bool onlyFixed) { m_selFont = font; m_onlyFixed = onlyFixed; displaySampleText(); emit fontSelected(m_selFont); }
KFontDialog::KFontDialog( QWidget *parent, const KFontChooser::DisplayFlags& flags, const QStringList &fontList, Qt::CheckState *sizeIsRelativeState ) : KDialog( parent ), d( new Private ) { setCaption( i18n("Select Font") ); setButtons( Ok | Cancel ); setDefaultButton(Ok); d->chooser = new KFontChooser( this, flags, fontList, 8, sizeIsRelativeState ); d->chooser->setObjectName( "fontChooser" ); connect( d->chooser , SIGNAL(fontSelected(QFont)) , this , SIGNAL(fontSelected(QFont)) ); setMainWidget( d->chooser ); }
void BtFontChooserWidget::sizeChanged(QListWidgetItem* current, QListWidgetItem* /*previous*/) { if (current == nullptr) return; m_font.setPointSize(m_sizeListWidget->currentItem()->text().toInt()); outputHtmlText(); emit fontSelected(m_font); }
void OFontSelector::changeFont ( ) { QFont f = selectedFont ( ); if ( d-> m_preview ) d-> m_preview-> setFont ( f ); emit fontSelected ( f ); }
void BtFontChooserWidget::fontChanged(QListWidgetItem* current, QListWidgetItem* /*previous*/) { if (current == nullptr) return; const QString fontFamily = current->text(); m_font.setFamily(fontFamily); loadStyles(fontFamily); outputHtmlText(); emit fontSelected(m_font); }
void KFontRequester::buttonClicked() { int result = KFontDialog::getFont(m_selFont, m_onlyFixed, parentWidget()); if(result == KDialog::Accepted) { displaySampleText(); emit fontSelected(m_selFont); } }
/*! Closes the dialog and sets its result code to \a result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return \a result. \sa QDialog::done() */ void QFontDialog::done(int result) { Q_D(QFontDialog); QDialog::done(result); if (result == Accepted) { // We check if this is the same font we had before, if so we emit currentFontChanged QFont selectedFont = currentFont(); if(selectedFont != d->selectedFont) emit(currentFontChanged(selectedFont)); d->selectedFont = selectedFont; emit fontSelected(d->selectedFont); } else d->selectedFont = QFont(); if (d->receiverToDisconnectOnClose) { disconnect(this, SIGNAL(fontSelected(QFont)), d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); d->receiverToDisconnectOnClose = 0; } d->memberToDisconnectOnClose.clear(); }
QWidget * TextAnnotationWidget::createStyleWidget() { QWidget * widget = new QWidget(); QVBoxLayout * lay = new QVBoxLayout( widget ); lay->setMargin( 0 ); if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) { QGroupBox * gb = new QGroupBox( widget ); lay->addWidget( gb ); gb->setTitle( i18n( "Icon" ) ); QHBoxLayout * gblay = new QHBoxLayout( gb ); m_pixmapSelector = new PixmapPreviewSelector( gb ); gblay->addWidget( m_pixmapSelector ); m_pixmapSelector->addItem( i18n( "Comment" ), "Comment" ); m_pixmapSelector->addItem( i18n( "Help" ), "Help" ); m_pixmapSelector->addItem( i18n( "Insert" ), "Insert" ); m_pixmapSelector->addItem( i18n( "Key" ), "Key" ); m_pixmapSelector->addItem( i18n( "New Paragraph" ), "NewParagraph" ); m_pixmapSelector->addItem( i18n( "Note" ), "Note" ); m_pixmapSelector->addItem( i18n( "Paragraph" ), "Paragraph" ); m_pixmapSelector->setIcon( m_textAnn->textIcon() ); connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) ); } else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace ) { QGridLayout * innerlay = new QGridLayout(); lay->addLayout( innerlay ); QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); innerlay->addWidget( tmplabel, 0, 0 ); m_fontReq = new KFontRequester( widget ); innerlay->addWidget( m_fontReq, 0, 1 ); m_fontReq->setFont( m_textAnn->textFont() ); tmplabel = new QLabel( i18n( "Align:" ), widget ); innerlay->addWidget( tmplabel, 1, 0 ); m_textAlign = new KComboBox( widget ); innerlay->addWidget( m_textAlign, 1, 1 ); m_textAlign->addItem( i18n("Left") ); m_textAlign->addItem( i18n("Center") ); m_textAlign->addItem( i18n("Right") ); m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() ); connect( m_fontReq, SIGNAL(fontSelected(QFont)), this, SIGNAL(dataChanged()) ); connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) ); }
void BtFontChooserWidget::styleChanged(QListWidgetItem* current, QListWidgetItem* /*previous*/) { if (current == nullptr) return; QString styleString = current->text(); setFontStyle(styleString, &m_font); // Save style if the user choose it if (m_styleListWidget->hasFocus()) m_choosenStyle = styleString; loadSizes(m_fontListWidget->currentItem()->text(), styleString); outputHtmlText(); emit fontSelected(m_font); }
QPlatformFontDialogHelper *QQuickQFontDialog::helper() { QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent()); if (parentItem) m_parentWindow = parentItem->window(); if (!m_dlgHelper) { m_dlgHelper = new QFontDialogHelper(); connect(m_dlgHelper, SIGNAL(currentFontChanged(QFont)), this, SLOT(setFont(QFont))); connect(m_dlgHelper, SIGNAL(fontSelected(QFont)), this, SLOT(setFont(QFont))); connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept())); connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject())); } return m_dlgHelper; }
NoteDock::NoteDock(QWidget *parent) : QWidget(parent), m_initializing(false), m_notes(0) { ui.setupUi(this); connect(ui.leName, SIGNAL(returnPressed(QString)), this, SLOT(nameChanged(QString))); connect(ui.leComment, SIGNAL(returnPressed(QString)), this, SLOT(commentChanged(QString))); connect(ui.kcbBgColor, SIGNAL(changed(QColor)), this, SLOT(backgroundColorChanged(QColor))); connect(ui.kcbTextColor, SIGNAL(changed(QColor)), this, SLOT(textColorChanged(QColor))); connect(ui.kfrTextFont, SIGNAL(fontSelected(QFont)), this, SLOT(textFontChanged(QFont))); TemplateHandler* templateHandler = new TemplateHandler(this, TemplateHandler::Worksheet); ui.gridLayout->addWidget(templateHandler, 8, 3); templateHandler->show(); connect(templateHandler, SIGNAL(loadConfigRequested(KConfig&)), this, SLOT(loadConfigFromTemplate(KConfig&))); connect(templateHandler, SIGNAL(saveConfigRequested(KConfig&)), this, SLOT(saveConfigAsTemplate(KConfig&))); }
QPlatformFontDialogHelper *QQuickPlatformFontDialog::helper() { QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent()); if (parentItem) m_parentWindow = parentItem->window(); if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()-> usePlatformNativeDialog(QPlatformTheme::FontDialog) ) { m_dlgHelper = static_cast<QPlatformFontDialogHelper *>(QGuiApplicationPrivate::platformTheme() ->createPlatformDialogHelper(QPlatformTheme::FontDialog)); if (!m_dlgHelper) return m_dlgHelper; connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept())); connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject())); connect(m_dlgHelper, SIGNAL(currentFontChanged(QFont)), this, SLOT(setFont(QFont))); connect(m_dlgHelper, SIGNAL(fontSelected(QFont)), this, SLOT(setFont(QFont))); } return m_dlgHelper; }
QWidget * TextAnnotationWidget::createStyleWidget() { QWidget * widget = new QWidget(); QVBoxLayout * lay = new QVBoxLayout( widget ); lay->setMargin( 0 ); if ( m_textAnn->textType() == Okular::TextAnnotation::Linked ) { QGroupBox * gb = new QGroupBox( widget ); lay->addWidget( gb ); gb->setTitle( i18n( "Icon" ) ); QHBoxLayout * gblay = new QHBoxLayout( gb ); m_pixmapSelector = new PixmapPreviewSelector( gb ); gblay->addWidget( m_pixmapSelector ); m_pixmapSelector->addItem( i18n( "Comment" ), "Comment" ); m_pixmapSelector->addItem( i18n( "Help" ), "Help" ); m_pixmapSelector->addItem( i18n( "Insert" ), "Insert" ); m_pixmapSelector->addItem( i18n( "Key" ), "Key" ); m_pixmapSelector->addItem( i18n( "New Paragraph" ), "NewParagraph" ); m_pixmapSelector->addItem( i18n( "Note" ), "Note" ); m_pixmapSelector->addItem( i18n( "Paragraph" ), "Paragraph" ); m_pixmapSelector->setIcon( m_textAnn->textIcon() ); connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) ); } QHBoxLayout * fontlay = new QHBoxLayout(); QLabel * tmplabel = new QLabel( i18n( "Font:" ), widget ); fontlay->addWidget( tmplabel ); m_fontReq = new KFontRequester( widget ); fontlay->addWidget( m_fontReq ); lay->addLayout( fontlay ); m_fontReq->setFont( m_textAnn->textFont() ); connect( m_fontReq, SIGNAL(fontSelected(QFont)), this, SIGNAL(dataChanged()) ); return widget; }
void TextEdit::fontChanged(const QFont &f) { if (m_bSelected){ if (!m_bNoSelected) emit fontSelected(f); m_bSelected = false; } if (m_param == NULL) return; m_bChanged = true; if (f.bold() != m_bBold){ m_bBold = f.bold(); Command cmd; cmd->id = CmdBold; cmd->flags = m_bBold ? COMMAND_CHECKED : 0; cmd->param = m_param; Event e(EventCommandChecked, cmd); e.process(); } if (f.italic() != m_bItalic){ m_bItalic = f.italic(); Command cmd; cmd->id = CmdItalic; cmd->flags = m_bItalic ? COMMAND_CHECKED : 0; cmd->param = m_param; Event e(EventCommandChecked, cmd); e.process(); } if (f.underline() != m_bUnderline){ m_bUnderline = f.underline(); Command cmd; cmd->id = CmdUnderline; cmd->flags = m_bUnderline ? COMMAND_CHECKED : 0; cmd->param = m_param; Event e(EventCommandChecked, cmd); e.process(); } m_bChanged = false; }
PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(parent) { m_ScMW=0; m_doc=0; m_item=0; m_haveDoc = false; m_haveItem = false; m_unitIndex = 0; m_unitRatio = 1.0; setupUi(this); fontSize->setPrefix( "" ); fontSizeLabel->setPixmap(IconManager::instance()->loadPixmap("zeichen.png")); lineSpacingLabel->setPixmap(IconManager::instance()->loadPixmap("linespacing2.png")); paraStyleLabel->setBuddy(paraStyleCombo); paraStyleClear->setIcon(IconManager::instance()->loadPixmap("16/edit-clear.png")); charStyleLabel->setBuddy(charStyleCombo); charStyleClear->setIcon(IconManager::instance()->loadPixmap("16/edit-clear.png")); colorWidgets = new PropertyWidget_TextColor(textTree); colorWidgetsItem = textTree->addItem( colorWidgets, tr("Color && Effects") ); flopBox = new PropertyWidget_Flop(textTree); flopItem = textTree->addItem( flopBox, tr("First Line Offset")); orphanBox = new PropertyWidget_Orphans(textTree); orphanItem = textTree->addItem(orphanBox, tr("Orphans and Widows")); parEffectWidgets = new PropertyWidget_ParEffect(textTree); parEffectItem = textTree->addItem(parEffectWidgets, tr("Paragraph Effects")); distanceWidgets = new PropertyWidget_Distance(textTree); distanceItem = textTree->addItem(distanceWidgets, tr("Columns && Text Distances")); //<< Optical Margins optMargins = new PropertyWidget_OptMargins(textTree); optMarginsItem = textTree->addItem(optMargins, tr("Optical Margins")); //>> Optical Margins hyphenationWidget = new PropertyWidget_Hyphenation(textTree); hyphenationWidgetItem = textTree->addItem(hyphenationWidget, tr("Hyphenation")); //<<Advanced Settings advancedWidgets = new PropertyWidget_Advanced(textTree); advancedWidgetsItem = textTree->addItem(advancedWidgets, tr("Advanced Settings")); //>>Advanced Settings fontfeaturesWidget = new PropertyWidget_FontFeatures(textTree); fontfeaturesWidgetItem = textTree->addItem(fontfeaturesWidget, tr("OpenType Font Features")); pathTextWidgets = new PropertyWidget_PathText(textTree); pathTextItem = textTree->addItem(pathTextWidgets, tr("Path Text Properties")); languageChange(); connect(lineSpacing , SIGNAL(valueChanged(double)), this, SLOT(handleLineSpacing())); connect(fonts , SIGNAL(fontSelected(QString )), this, SLOT(handleTextFont(QString))); connect(fontSize , SIGNAL(valueChanged(double)), this, SLOT(handleFontSize())); connect(textAlignment , SIGNAL(State(int)) , this, SLOT(handleAlignment(int))); connect(textDirection , SIGNAL(State(int)) , this, SLOT(handleDirection(int))); connect(charStyleClear, SIGNAL(clicked()), this, SLOT(doClearCStyle())); connect(paraStyleClear, SIGNAL(clicked()), this, SLOT(doClearPStyle())); connect(flopBox->flopGroup, SIGNAL(buttonClicked( int )), this, SLOT(handleFirstLinePolicy(int))); connect(lineSpacingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLineSpacingMode(int))); connect(langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeLang(int))); m_haveItem = false; setEnabled(false); }
/*! \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(); }
PropertiesPalette_Text::PropertiesPalette_Text( QWidget* parent) : QWidget(parent) { m_ScMW=0; m_doc=0; m_haveDoc = false; m_haveItem = false; m_unitRatio = 1.0; setupUi(this); setSizePolicy( QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); fontSize->setPrefix( "" ); fontSizeLabel->setPixmap(loadIcon("Zeichen.xpm")); lineSpacingLabel->setPixmap(loadIcon("linespacing2.png")); paraStyleLabel->setBuddy(paraStyleCombo); paraStyleClear->setIcon(loadIcon("16/edit-clear.png")); charStyleLabel->setBuddy(charStyleCombo); charStyleClear->setIcon(loadIcon("16/edit-clear.png")); colorWidgets = new PropertyWidget_TextColor(textTree); colorWidgetsItem = textTree->addWidget( tr("Color && Effects"), colorWidgets); flopBox = new PropertyWidget_Flop(textTree); flopItem = textTree->addWidget( tr("First Line Offset"), flopBox); orphanBox = new PropertyWidget_Orphans(textTree); orphanItem = textTree->addWidget( tr("Orphans and Widows"), orphanBox); parEffectWidgets = new PropertyWidget_ParEffect(textTree); parEffectItem = textTree->addWidget( tr("Paragraph Effects"), parEffectWidgets); distanceWidgets = new PropertyWidget_Distance(textTree); distanceItem = textTree->addWidget( tr("Columns && Text Distances"), distanceWidgets); //<< Optical Margins optMargins = new PropertyWidget_OptMargins(textTree); optMarginsItem = textTree->addWidget( tr("Optical Margins"), optMargins); //>> Optical Margins //<<Advanced Settings advancedWidgets = new PropertyWidget_Advanced(textTree); advancedWidgetsItem = textTree->addWidget( tr("Advanced Settings"), advancedWidgets); //>>Advanced Settings pathTextWidgets = new PropertyWidget_PathText(textTree); pathTextItem = textTree->addWidget( tr("Path Text Properties"), pathTextWidgets); languageChange(); connect(lineSpacing , SIGNAL(valueChanged(double)), this, SLOT(handleLineSpacing())); connect(fonts , SIGNAL(fontSelected(QString )), this, SLOT(handleTextFont(QString))); connect(fontSize , SIGNAL(valueChanged(double)), this, SLOT(handleFontSize())); connect(textAlignment , SIGNAL(State(int)) , this, SLOT(handleAlignement(int))); connect(charStyleClear, SIGNAL(clicked()), this, SLOT(doClearCStyle())); connect(paraStyleClear, SIGNAL(clicked()), this, SLOT(doClearPStyle())); connect(flopBox->flopGroup, SIGNAL(buttonClicked( int )), this, SLOT(handleFirstLinePolicy(int))); connect(lineSpacingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(handleLineSpacingMode(int))); m_haveItem = false; setEnabled(false); }
diaFontSkin::diaFontSkin(QWidget *parent,QFrame *menu,QString pTitl,QFont pFont) : QFrame(parent) { parWin=parent; parMen=menu; int pWidt=505; int pHeig=395; int iLefx=-1; int iTopy=-1; iPr=QApplication::desktop()->width()-1; iPb=QApplication::desktop()->height()-1; iPm=QApplication::desktop()->height()/2; QString sAppFont=qApp->font().family(); if (iLefx==-1) iLefx=fCalcPosX(pWidt); if (iTopy==-1) iTopy=fCalcPosY(pHeig,parMen); this->setStyleSheet("background-color:#151515;color:#ffffff;border:1px solid #0055aa;border-radius:3px;"); this->setMinimumSize(QSize(pWidt,pHeig)); this->setMaximumSize(QSize(pWidt,pHeig)); this->setContentsMargins(0,0,0,0); this->setCursor(Qt::ArrowCursor); this->setGeometry(iLefx,iTopy,pWidt,pHeig); this->move(iLefx,iTopy); QLabel *labTitl = new QLabel(pTitl,this); labTitl->setStyleSheet(fStylTitl()); labTitl->setMinimumSize(pWidt,30); labTitl->move(0,0); QToolButton *butClos=new QToolButton(this); butClos->setStyleSheet(fStylClos()); butClos->setContentsMargins(0,0,0,0); butClos->resize(16,16); butClos->move(pWidt-22,7); butClos->setAutoRepeat(false); connect(butClos,SIGNAL(clicked()),this,SLOT(fGridClos())); diaFont=new QFontDialog(this); diaFont->setOption(QFontDialog::DontUseNativeDialog); diaFont->setWindowFlags(Qt::SubWindow); diaFont->setSizeGripEnabled(false); diaFont->setCursor(Qt::ArrowCursor); diaFont->setCurrentFont(pFont); diaFont->move(1,30); connect(diaFont,SIGNAL(fontSelected(QFont)),this,SLOT(fFontGet(QFont))); connect(diaFont,SIGNAL(rejected()),this,SLOT(fGridClos())); QList<QPushButton *> butt=diaFont->findChildren<QPushButton *>(); butt[0]->setText("Confirm"); butt[0]->setIcon(QPixmap(":/Imag/QSTit_okok.png")); butt[0]->setIconSize(QSize(16,16)); butt[0]->setStyleSheet("font:normal 11px "+sAppFont+";height:20px;width:70px;background-color:#151515;color:#ffffff;border:1px solid #0055aa;border-radius:3px;text-align:left;padding-left:2px;"); butt[1]->setText("Cancel"); butt[1]->setIcon(QPixmap(":/Imag/QSTit_canc.png")); butt[1]->setIconSize(QSize(16,16)); butt[1]->setStyleSheet("font:normal 11px "+sAppFont+";height:20px;width:70px;background-color:#151515;color:#ffffff;border:1px solid #0055aa;border-radius:3px;text-align:left;padding-left:2px;"); QString sStyl="QFontDialog {background-color:#151515;border:none;}"; sStyl+="QWidget {border:none;}"; sStyl+="QLabel {font:normal 11px "+sAppFont+";background-color:#151515;}"; sStyl+="QGroupBox {margin-top:7px;border:1px solid #555555;}"; sStyl+="QGroupBox::title {font:normal 11px "+sAppFont+";subcontrol-origin:margin;subcontrol-position:top left;border:none;}"; sStyl+="QComboBox {font:normal 11px "+sAppFont+";background-color:#cccccc;color:#000000;border:none;}"; sStyl+="QComboBox:editable {background-color:#aaaaaa;color:#000000;border:1px solid #555555;}"; sStyl+="QComboBox:!editable {background-color:#aaaaaa;color:#000000;border:none;}"; sStyl+="QComboBox QAbstractItemView {selection-background-color:#aaaaaa;color:#000000;border:none;}"; sStyl+="QAbstractScrollArea {font:normal 11px "+sAppFont+";background-color:#cccccc;color:#000000;border:1px solid #aaaaaa;}"; sStyl+="QLineEdit {background-color:#aaaaaa;color:#000000;border:none;selection-background-color:#0055aa;selection-color:#000000;}"; diaFont->setStyleSheet(sStyl); diaFont->show(); this->show(); this->setFocus(); }
ConfigWidget::ConfigWidget(QWidget* parent, GlobalConfig& settings, Animatron* plugin) :QWidget(parent), Settings(settings), Plugin(plugin) { this->resize(784, 644); gridLayout = new QGridLayout(this); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); label_1 = new QLabel(this); label_1->setText("Font:"); gridLayout->addWidget(label_1, 0, 0, 1, 1); FontBar = new QHBoxLayout(); FontBar->setObjectName(QString::fromUtf8("FontBar")); FontChooser = new KFontRequester(this); FontChooser->setObjectName(QString::fromUtf8("FontChooser")); FontChooser->setFont(Settings.Font); connect(FontChooser, SIGNAL(fontSelected(QFont)), this, SLOT(modified())); FontBar->addWidget(FontChooser); gridLayout->addLayout(FontBar, 0, 1, 1, 1); label_2 = new QLabel(this); label_2->setText("Color:"); gridLayout->addWidget(label_2, 1, 0, 1, 1); ColorBar = new QHBoxLayout(); ColorBar->setObjectName(QString::fromUtf8("ColorBar")); ColorBtn = new KColorButton(this); ColorBtn->setObjectName(QString::fromUtf8("ColorBtn")); ColorBtn->setMinimumSize(QSize(64, 0)); ColorBtn->setColor(Settings.Color); ColorBtn->setDefaultColor(QColor(0, 255, 0)); connect(ColorBtn, SIGNAL(changed(QColor)), this, SLOT(modified())); ColorBar->addWidget(ColorBtn); Spacer1 = new QSpacerItem(187, 17, QSizePolicy::Expanding, QSizePolicy::Minimum); ColorBar->addItem(Spacer1); gridLayout->addLayout(ColorBar, 1, 1, 1, 1); label_3 = new QLabel(this); label_3->setText("Sync:"); gridLayout->addWidget(label_3, 2, 0, 1, 1); RefreshBar = new QHBoxLayout(); RefreshBar->setObjectName(QString::fromUtf8("RefreshBar")); RefreshCombo = new KIntSpinBox(this); RefreshCombo->setObjectName(QString::fromUtf8("RefreshCombo")); RefreshCombo->setEnabled(false); RefreshCombo->setMinimumSize(QSize(64, 0)); RefreshCombo->setMinimum(10); RefreshCombo->setMaximum(50); RefreshCombo->setSingleStep(5); RefreshCombo->setValue(Settings.Refresh); //connect(RefreshCombo, SIGNAL(valueChanged(int)), this, SLOT(modified())); RefreshBar->addWidget(RefreshCombo); Spacer3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); RefreshBar->addItem(Spacer3); gridLayout->addLayout(RefreshBar, 2, 1, 1, 1); label_4 = new QLabel(this); label_4->setText("Grid:"); gridLayout->addWidget(label_4, 3, 0, 1, 1); SizeBar = new QHBoxLayout(); SizeBar->setObjectName(QString::fromUtf8("SizeBar")); WidthSpinner = new KIntSpinBox(this); WidthSpinner->setObjectName(QString::fromUtf8("WidthSpinner")); WidthSpinner->setMinimumSize(QSize(64, 0)); WidthSpinner->setMinimum(32); WidthSpinner->setMaximum(256); WidthSpinner->setSingleStep(4); WidthSpinner->setValue(Settings.HorizontalRezolution); connect(WidthSpinner, SIGNAL(valueChanged(int)), this, SLOT(modified())); SizeBar->addWidget(WidthSpinner); HeightSpinner = new KIntSpinBox(this); HeightSpinner->setObjectName(QString::fromUtf8("HeightSpinner")); HeightSpinner->setMinimumSize(QSize(64, 0)); HeightSpinner->setMinimum(24); HeightSpinner->setMaximum(256); HeightSpinner->setSingleStep(4); HeightSpinner->setValue(Settings.VerticalRezolution); connect(HeightSpinner, SIGNAL(valueChanged(int)), this, SLOT(modified())); SizeBar->addWidget(HeightSpinner); label_5 = new QLabel(this); label_5->setText("Bins:"); SizeBar->addWidget(label_5); CountSpinner = new KIntSpinBox(this); CountSpinner->setObjectName(QString::fromUtf8("CountSpinner")); CountSpinner->setMinimumSize(QSize(64, 0)); CountSpinner->setMinimum(4); CountSpinner->setMaximum(64); CountSpinner->setSingleStep(2); CountSpinner->setValue(Settings.Bins); connect(CountSpinner, SIGNAL(valueChanged(int)), this, SLOT(modified())); SizeBar->addWidget(CountSpinner); Spacer2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); SizeBar->addItem(Spacer2); gridLayout->addLayout(SizeBar, 3, 1, 1, 1); label_6 = new QLabel(this); label_6->setText("Base:"); gridLayout->addWidget(label_6, 4, 0, 1, 1); BaseBar = new QHBoxLayout(); BaseBar->setObjectName(QString::fromUtf8("BaseBar")); BaseCombo = new KComboBox(this); BaseCombo->setObjectName(QString::fromUtf8("BaseCombo")); BaseCombo->setMinimumSize(QSize(64, 0)); BaseCombo->setAutoCompletion(false); BaseCombo->addItem("10"); BaseCombo->addItem("16"); BaseCombo->addItem("36"); BaseCombo->addItem("62"); int x; for (x = 0; x < BaseCombo->count(); ++x) { if (Settings.Base == BaseCombo->itemText(x).toInt()) { BaseCombo->setCurrentIndex(x); break; } } connect(BaseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(modified())); BaseBar->addWidget(BaseCombo); Spacer4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); BaseBar->addItem(Spacer4); gridLayout->addLayout(BaseBar, 4, 1, 1, 1); SettingsGroup = new KTabWidget(this); SettingsGroup->setObjectName(QString::fromUtf8("SettingsGroup")); SettingsGroup->setTabPosition(QTabWidget::West); //setup BackgroundPage BackgroundSettings = new QWidget(); BackgroundPage.setupUi(BackgroundSettings); pImageListModel = new BackgroundListModel(instance, this); pImageListModel->setResizeMethod((Plasma::Wallpaper::ResizeMethod)Settings.Arrangement); pImageListModel->setWallpaperSize(QSize(1024, 768)); pImageListModel->reload(Settings.History); QTimer::singleShot(250, this, SLOT(_async_start())); BackgroundPage.ImageList->setItemDelegate(new BackgroundDelegate(BackgroundPage.ImageList)); BackgroundPage.ImageList->setMinimumWidth( (BackgroundDelegate::SCREENSHOT_SIZE + BackgroundDelegate::MARGIN * 2 + BackgroundDelegate::BLUR_INCREMENT) * 3 + BackgroundPage.ImageList->spacing() * 4 + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent) + QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2 + 7 ); BackgroundPage.ImageList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); connect(BackgroundPage.ImageList, SIGNAL(clicked(const QModelIndex&)), this, SLOT(imageSelected())); BackgroundPage.ImageList->setSpacing(2); BackgroundPage.ImageList->setViewMode(QListView::IconMode); RemoveButtonManager* rbmanager = new RemoveButtonManager(BackgroundPage.ImageList, &Settings.History); connect(rbmanager, SIGNAL(removeClicked(QString)), this, SLOT(imagesRemove(QString))); BackgroundPage.ArrangementCombo->addItem("No Background", 0); //BackgroundPage.ArrangementCombo->addItem("Scaled & Cropped", Plasma::Wallpaper::ScaledAndCroppedResize); //BackgroundPage.ArrangementCombo->addItem("Scaled", Plasma::Wallpaper::ScaledResize); //BackgroundPage.ArrangementCombo->addItem("Scaled, keep proportions", Plasma::Wallpaper::MaxpectResize); BackgroundPage.ArrangementCombo->addItem("Centered", Plasma::Wallpaper::CenteredResize); //BackgroundPage.ArrangementCombo->addItem("Tiled", Plasma::Wallpaper::TiledResize); //BackgroundPage.ArrangementCombo->addItem("Center Tiled", Plasma::Wallpaper::CenterTiledResize); for (x = 0; x < BackgroundPage.ArrangementCombo->count(); ++x) { if (Settings.Arrangement == BackgroundPage.ArrangementCombo->itemData(x).value<int>()) { BackgroundPage.ArrangementCombo->setCurrentIndex(x); break; } } connect(BackgroundPage.ArrangementCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(modified())); BackgroundPage.OpenWallBtn->setIcon(KIcon("document-open")); connect(BackgroundPage.OpenWallBtn, SIGNAL(clicked()), this, SLOT(imagesAdd())); pOpenDialog = NULL; BackgroundPage.GetNewWallBtn->setIcon(KIcon("get-hot-new-stuff")); connect(BackgroundPage.GetNewWallBtn, SIGNAL(clicked()), this, SLOT(imagesBrowse())); pBrowseDialog = NULL; BackgroundSettings->setObjectName(QString::fromUtf8("BackgroundSettings")); SettingsGroup->addTab(BackgroundSettings, QString()); SettingsGroup->setTabText(0, "Background"); //setup FunctionalityPage FunctionalitySettings = new QWidget(); FunctionalityPage.setupUi(FunctionalitySettings); connect(FunctionalityPage.RuleEdit, SIGNAL(textChanged(QString)), this, SLOT(desktopRuleCompleted(QString))); pDesktopList = new DesktopList(FunctionalityPage.DesktopWidget); FunctionalityPage.DesktopLayout->addWidget(pDesktopList); connect(pDesktopList, SIGNAL(IndexChanged(int)), this, SLOT(desktopSelected(int))); pDesktopList->shout(); FunctionalityPage.PrevDesktopBtn->setIcon(KIcon("arrow-left")); connect(FunctionalityPage.PrevDesktopBtn, SIGNAL(clicked(bool)), pDesktopList, SLOT(prev())); FunctionalityPage.NextDesktopBtn->setIcon(KIcon("arrow-right")); connect(FunctionalityPage.NextDesktopBtn, SIGNAL(clicked(bool)), pDesktopList, SLOT(next())); pAddRuleMenu = new AddRuleMenu(pDesktopList); FunctionalityPage.AddRuleBtn->setIcon(KIcon("list-add")); FunctionalityPage.AddRuleBtn->setMenu(pAddRuleMenu); connect(pAddRuleMenu, SIGNAL(perform(QString)), this, SLOT(desktopRuleAdd(QString))); pRemRuleMenu = new RemRuleMenu(pDesktopList); FunctionalityPage.RemRuleBtn->setIcon(KIcon("list-remove")); FunctionalityPage.RemRuleBtn->setMenu(pRemRuleMenu); connect(pRemRuleMenu, SIGNAL(perform(QString)), this, SLOT(destopRuleRemove(QString))); FunctionalitySettings->setObjectName(QString::fromUtf8("FunctionalitySettings")); SettingsGroup->addTab(FunctionalitySettings, QString()); SettingsGroup->setTabText(1, "Quantum Lock"); gridLayout->addWidget(SettingsGroup, 5, 0, 1, 2); SettingsGroup->setCurrentIndex(0); connect(this, SIGNAL(apply(bool)), parent, SLOT(settingsChanged(bool))); emit apply(false); }
// 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(); }
CartesianPlotLegendDock::CartesianPlotLegendDock(QWidget *parent): QWidget(parent), m_legend(0), labelWidget(0), m_initializing(false), m_completion(new KUrlCompletion()) { ui.setupUi(this); //"Title"-tab QHBoxLayout* hboxLayout = new QHBoxLayout(ui.tabTitle); labelWidget=new LabelWidget(ui.tabTitle); labelWidget->setNoGeometryMode(true); hboxLayout->addWidget(labelWidget); hboxLayout->setContentsMargins(2,2,2,2); hboxLayout->setSpacing(2); //"Background"-tab ui.kleBackgroundFileName->setClearButtonShown(true); ui.bOpen->setIcon( KIcon("document-open") ); ui.kleBackgroundFileName->setCompletionObject(m_completion); //adjust layouts in the tabs for (int i=0; i<ui.tabWidget->count(); ++i){ QGridLayout* layout = dynamic_cast<QGridLayout*>(ui.tabWidget->widget(i)->layout()); if (!layout) continue; layout->setContentsMargins(2,2,2,2); layout->setHorizontalSpacing(2); layout->setVerticalSpacing(2); } //SIGNAL/SLOT //General connect( ui.leName, SIGNAL(returnPressed()), this, SLOT(nameChanged()) ); connect( ui.leComment, SIGNAL(returnPressed()), this, SLOT(commentChanged()) ); connect( ui.chkVisible, SIGNAL(clicked(bool)), this, SLOT(visibilityChanged(bool)) ); connect( ui.kfrLabelFont, SIGNAL(fontSelected(QFont)), this, SLOT(labelFontChanged(QFont)) ); connect( ui.kcbLabelColor, SIGNAL(changed(QColor)), this, SLOT(labelColorChanged(QColor)) ); connect( ui.cbOrder, SIGNAL(currentIndexChanged(int)), this, SLOT(labelOrderChanged(int)) ); connect( ui.sbLineSymbolWidth, SIGNAL(valueChanged(double)), this, SLOT(lineSymbolWidthChanged(double)) ); 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)) ); //Background connect( ui.cbBackgroundType, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundTypeChanged(int)) ); connect( ui.cbBackgroundColorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundColorStyleChanged(int)) ); connect( ui.cbBackgroundImageStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundImageStyleChanged(int)) ); connect( ui.cbBackgroundBrushStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(backgroundBrushStyleChanged(int)) ); connect(ui.bOpen, SIGNAL(clicked(bool)), this, SLOT(selectFile())); connect( ui.kleBackgroundFileName, SIGNAL(returnPressed()), this, SLOT(fileNameChanged()) ); connect( ui.kleBackgroundFileName, SIGNAL(clearButtonClicked()), this, SLOT(fileNameChanged()) ); connect( ui.kcbBackgroundFirstColor, SIGNAL(changed(QColor)), this, SLOT(backgroundFirstColorChanged(QColor)) ); connect( ui.kcbBackgroundSecondColor, SIGNAL(changed(QColor)), this, SLOT(backgroundSecondColorChanged(QColor)) ); connect( ui.sbBackgroundOpacity, SIGNAL(valueChanged(int)), this, SLOT(backgroundOpacityChanged(int)) ); //Border connect( ui.cbBorderStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(borderStyleChanged(int)) ); connect( ui.kcbBorderColor, SIGNAL(changed(QColor)), this, SLOT(borderColorChanged(QColor)) ); connect( ui.sbBorderWidth, SIGNAL(valueChanged(double)), this, SLOT(borderWidthChanged(double)) ); connect( ui.sbBorderCornerRadius, SIGNAL(valueChanged(double)), this, SLOT(borderCornerRadiusChanged(double)) ); connect( ui.sbBorderOpacity, SIGNAL(valueChanged(int)), this, SLOT(borderOpacityChanged(int)) ); //Layout connect( ui.sbLayoutTopMargin, SIGNAL(valueChanged(double)), this, SLOT(layoutTopMarginChanged(double)) ); connect( ui.sbLayoutBottomMargin, SIGNAL(valueChanged(double)), this, SLOT(layoutBottomMarginChanged(double)) ); connect( ui.sbLayoutLeftMargin, SIGNAL(valueChanged(double)), this, SLOT(layoutLeftMarginChanged(double)) ); connect( ui.sbLayoutRightMargin, SIGNAL(valueChanged(double)), this, SLOT(layoutRightMarginChanged(double)) ); connect( ui.sbLayoutHorizontalSpacing, SIGNAL(valueChanged(double)), this, SLOT(layoutHorizontalSpacingChanged(double)) ); connect( ui.sbLayoutVerticalSpacing, SIGNAL(valueChanged(double)), this, SLOT(layoutVerticalSpacingChanged(double)) ); connect( ui.sbLayoutColumnCount, SIGNAL(valueChanged(int)), this, SLOT(layoutColumnCountChanged(int)) ); TemplateHandler* templateHandler = new TemplateHandler(this, TemplateHandler::CartesianPlotLegend); ui.verticalLayout->addWidget(templateHandler); templateHandler->show(); connect(templateHandler, SIGNAL(loadConfigRequested(KConfig&)), this, SLOT(loadConfigFromTemplate(KConfig&))); connect(templateHandler, SIGNAL(saveConfigRequested(KConfig&)), this, SLOT(saveConfigAsTemplate(KConfig&))); connect(templateHandler, SIGNAL(info(QString)), this, SIGNAL(info(QString))); init(); }
InsertTextTool::InsertTextTool(QObject* const parent) : EditorTool(parent), d(new Private) { setObjectName(QLatin1String("inserttext")); // ------------------------------------------------------------- QFrame* const frame = new QFrame(nullptr); frame->setFrameStyle(QFrame::Panel|QFrame::Sunken); QVBoxLayout* const l = new QVBoxLayout(frame); d->previewWidget = new InsertTextWidget(480, 320, frame); l->addWidget(d->previewWidget); d->previewWidget->setWhatsThis(i18n("This previews the text inserted in the image. " "You can use the mouse to move the text to the right location.")); setToolView(frame); // ------------------------------------------------------------- d->gboxSettings = new EditorToolSettings(nullptr); d->textEdit = new QTextEdit(); d->textEdit->setWordWrapMode(QTextOption::NoWrap); d->textEdit->setWhatsThis( i18n("Here, enter the text you want to insert in your image.")); // ------------------------------------------------------------- d->fontChooserWidget = new DFontProperties(nullptr, DFontProperties::NoDisplayFlags); d->fontChooserWidget->setSampleBoxVisible(false); d->fontChooserWidget->setWhatsThis(i18n("Here you can choose the font to be used.")); // ------------------------------------------------------------- QWidget* const alignBox = new QWidget(); QHBoxLayout* const hlay = new QHBoxLayout(alignBox); d->alignButtonGroup = new QButtonGroup(alignBox); d->alignButtonGroup->setExclusive(true); QToolButton* const alignLeft = new QToolButton(alignBox); d->alignButtonGroup->addButton(alignLeft, InsertTextWidget::ALIGN_LEFT); alignLeft->setIcon(QIcon::fromTheme(QLatin1String("format-justify-left"))); alignLeft->setCheckable(true); alignLeft->setToolTip(i18n("Align text to the left")); QToolButton* const alignRight = new QToolButton(alignBox); d->alignButtonGroup->addButton(alignRight, InsertTextWidget::ALIGN_RIGHT); alignRight->setIcon(QIcon::fromTheme(QLatin1String("format-justify-right"))); alignRight->setCheckable(true); alignRight->setToolTip(i18n("Align text to the right")); QToolButton* const alignCenter = new QToolButton(alignBox); d->alignButtonGroup->addButton(alignCenter, InsertTextWidget::ALIGN_CENTER); alignCenter->setIcon(QIcon::fromTheme(QLatin1String("format-justify-center"))); alignCenter->setCheckable(true); alignCenter->setToolTip(i18n("Align text to center")); QToolButton* alignBlock = new QToolButton(alignBox); d->alignButtonGroup->addButton(alignBlock, InsertTextWidget::ALIGN_BLOCK); alignBlock->setIcon(QIcon::fromTheme(QLatin1String("format-justify-fill"))); alignBlock->setCheckable(true); alignBlock->setToolTip(i18n("Align text to a block")); hlay->setContentsMargins(QMargins()); hlay->setSpacing(0); hlay->addStretch(); hlay->addWidget(alignLeft); hlay->addWidget(alignRight); hlay->addWidget(alignCenter); hlay->addWidget(alignBlock); hlay->addStretch(); // ------------------------------------------------------------- QLabel* const label1 = new QLabel(i18n("Rotation:")); d->textRotation = new QComboBox(); d->textRotation->addItem(i18nc("no rotation", "None")); d->textRotation->addItem(i18n("90 Degrees")); d->textRotation->addItem(i18n("180 Degrees")); d->textRotation->addItem(i18n("270 Degrees")); d->textRotation->setWhatsThis(i18n("Select the text rotation to use here.")); // ------------------------------------------------------------- QLabel* const label2 = new QLabel(i18nc("font color", "Color:")); d->fontColorButton = new DColorSelector(); d->fontColorButton->setColor(Qt::black); d->fontColorButton->setWhatsThis(i18n("Set here the font color to use.")); // ------------------------------------------------------------- QLabel* const label3 = new QLabel(i18nc("text opacity", "Opacity:")); d->textOpacity = new DIntNumInput(); d->textOpacity->setRange(0, 100, 1); d->textOpacity->setDefaultValue(100); d->textOpacity->setSuffix(QLatin1String("%")); d->textOpacity->setWhatsThis(i18n("Select the text opacity to use here.")); // ------------------------------------------------------------- d->borderText = new QCheckBox(i18n("Add border")); d->borderText->setToolTip(i18n("Add a solid border around text using current text color")); d->transparentText = new QCheckBox(i18n("Semi-transparent")); d->transparentText->setToolTip(i18n("Use semi-transparent text background under image")); // ------------------------------------------------------------- const int spacing = d->gboxSettings->spacingHint(); QGridLayout* const mainLayout = new QGridLayout(); mainLayout->addWidget(d->textEdit, 0, 0, 3, -1); mainLayout->addWidget(d->fontChooserWidget, 3, 0, 1, -1); mainLayout->addWidget(alignBox, 4, 0, 1, -1); mainLayout->addWidget(label1, 5, 0, 1, 1); mainLayout->addWidget(d->textRotation, 5, 1, 1, 1); mainLayout->addWidget(label2, 6, 0, 1, 1); mainLayout->addWidget(d->fontColorButton, 6, 1, 1, 1); mainLayout->addWidget(label3, 7, 0, 1, 1); mainLayout->addWidget(d->textOpacity, 7, 1, 1, 1); mainLayout->addWidget(d->borderText, 8, 0, 1, -1); mainLayout->addWidget(d->transparentText, 9, 0, 1, -1); mainLayout->setRowStretch(10, 10); mainLayout->setColumnStretch(1, 5); mainLayout->setColumnStretch(2, 10); mainLayout->setContentsMargins(spacing, spacing, spacing, spacing); mainLayout->setSpacing(spacing); d->gboxSettings->plainPage()->setLayout(mainLayout); // ------------------------------------------------------------- setToolSettings(d->gboxSettings); // ------------------------------------------------------------- connect(d->fontChooserWidget, SIGNAL(fontSelected(QFont)), this, SLOT(slotFontPropertiesChanged(QFont))); connect(d->fontColorButton, SIGNAL(signalColorSelected(QColor)), this, SLOT(slotUpdatePreview())); connect(d->textOpacity, SIGNAL(valueChanged(int)), this, SLOT(slotUpdatePreview())); connect(d->textEdit, SIGNAL(textChanged()), this, SLOT(slotUpdatePreview())); connect(d->alignButtonGroup, SIGNAL(buttonReleased(int)), this, SLOT(slotAlignModeChanged(int))); connect(d->borderText, SIGNAL(toggled(bool)), this, SLOT(slotUpdatePreview())); connect(d->transparentText, SIGNAL(toggled(bool)), this, SLOT(slotUpdatePreview())); connect(d->textRotation, SIGNAL(activated(int)), this, SLOT(slotUpdatePreview())); connect(this, SIGNAL(signalUpdatePreview()), this, SLOT(slotUpdatePreview())); // ------------------------------------------------------------- slotUpdatePreview(); }