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 FontPreviewWidget::on_btnSelectFont_clicked() { bool ok; QFont font = QFontDialog::getFont(&ok,_currentFont, this); if (ok) { _currentFont = font; QString item = tr("%1 - [%2 pt]").arg(_currentFont.family()).arg(_currentFont.pointSizeF()); ui->lblFontSelected->setText(item); ui->txtPrevirew->setFont(_currentFont); emit currentFontChanged(); emit currentFontChanged(_currentFont); } }
//BEGIN VariableFontEditor VariableFontEditor::VariableFontEditor(VariableFontItem* item, QWidget* parent) : VariableEditor(item, parent) { QGridLayout* l = (QGridLayout *) layout(); m_comboBox = new KFontComboBox(this); m_comboBox->setCurrentFont(item->value()); l->addWidget(m_comboBox, 0, 2, Qt::AlignLeft); connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SIGNAL(valueChanged())); connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(activateItem())); connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(setItemValue(QFont))); }
FormattedTextWidget::FormattedTextWidget( QWidget *parent ) : QWidget( parent ), d( new Private() ) { d->setupUi( this ); d->m_formattedTextToolBar->insertSeparator( d->m_actionAddImage ); QPixmap textColorPixmap(20, 20); textColorPixmap.fill( d->m_description->textCursor().charFormat().foreground().color() ); d->m_actionColor->setIcon( textColorPixmap ); d->m_textColorDialog = new QColorDialog( this ); d->m_textColorDialog->setOption( QColorDialog::ShowAlphaChannel ); d->m_textColorDialog->setCurrentColor( d->m_description->textCursor().charFormat().foreground().color() ); d->m_fontSize->setValidator( new QIntValidator( 1, 9000, this ) ); int index = d->m_fontSize->findText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) ); if( index != -1 ) { d->m_fontSize->setCurrentIndex( index ); } else { d->m_fontSize->lineEdit()->setText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) ); } connect( d->m_actionColor, SIGNAL(triggered()), d->m_textColorDialog, SLOT(exec()) ); connect( d->m_textColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(setTextCursorColor(QColor)) ); connect( d->m_isFormattedTextMode, SIGNAL(toggled(bool)), this, SLOT(toggleDescriptionEditMode(bool)) ); connect( d->m_fontFamily, SIGNAL(currentFontChanged(QFont)), this, SLOT(setTextCursorFont(QFont)) ); connect( d->m_fontSize, SIGNAL(editTextChanged(QString)), this, SLOT(setTextCursorFontSize(QString)) ); connect( d->m_actionBold, SIGNAL(toggled(bool)), this, SLOT(setTextCursorBold(bool)) ); connect( d->m_actionItalics, SIGNAL(toggled(bool)), this, SLOT(setTextCursorItalic(bool)) ); connect( d->m_actionUnderlined, SIGNAL(toggled(bool)), this, SLOT(setTextCursorUnderlined(bool)) ); connect( d->m_actionAddImage, SIGNAL(triggered()), this, SLOT(addImageToDescription()) ); connect( d->m_actionAddLink, SIGNAL(triggered()), this, SLOT(addLinkToDescription()) ); connect( d->m_description, SIGNAL(cursorPositionChanged()), this, SLOT(updateDescriptionEditButtons()) ); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: backgroundButtonGroupClicked((*reinterpret_cast< QAbstractButton*(*)>(_a[1]))); break; case 1: buttonGroupClicked((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: deleteItem(); break; case 3: pointerGroupClicked((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: bringToFront(); break; case 5: sendToBack(); break; case 6: itemInserted((*reinterpret_cast< DiagramItem*(*)>(_a[1]))); break; case 7: textInserted((*reinterpret_cast< QGraphicsTextItem*(*)>(_a[1]))); break; case 8: currentFontChanged((*reinterpret_cast< const QFont(*)>(_a[1]))); break; case 9: fontSizeChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 10: sceneScaleChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 11: textColorChanged(); break; case 12: itemColorChanged(); break; case 13: lineColorChanged(); break; case 14: textButtonTriggered(); break; case 15: fillButtonTriggered(); break; case 16: lineButtonTriggered(); break; case 17: handleFontChange(); break; case 18: itemSelected((*reinterpret_cast< QGraphicsItem*(*)>(_a[1]))); break; case 19: about(); break; default: ; } _id -= 20; } return _id; }
Widget::Widget(QWidget *parent) : QWidget(parent) { QFontComboBox *fontcombo[5]; for(int i=0; i < 5; i++) { fontcombo[i] = new QFontComboBox(this); } // 0x0, 모든폰트 fontcombo[0]->setFontFilters(QFontComboBox::AllFonts); // 0x1, 확대 및 축소와 같은 동적 자동 변환이 가능한 폰트 fontcombo[1]->setFontFilters(QFontComboBox::ScalableFonts); // 0x2, 동적 자동 변환이 제공 되지 않는 폰트 fontcombo[2]->setFontFilters(QFontComboBox::NonScalableFonts); // 0x3, 일정한 문자 넓이 형태를 제공하는 폰트 fontcombo[3]->setFontFilters(QFontComboBox::MonospacedFonts); // 0x4, 넓이와 폭의 균형이 잡힌 폰트 fontcombo[4]->setFontFilters(QFontComboBox::ProportionalFonts); int ypos = 30; for(int i=0; i < 5; i++) { fontcombo[i]->setGeometry(10, ypos, 200, 30); ypos += 40; } // lbl 추가 lbl = new QLabel("I love Qt programing", this); lbl->setGeometry(10, ypos, 200, 30); // 폰트의 인덱스를 리턴하는 시그널 함수 currentIndexChanged(int) connect(fontcombo[0], SIGNAL(currentIndexChanged(int)), this, SLOT(changedIndex(int))); // 선택한 폰트의 QFont를 리턴하는 시그널 함수 currentFontChanged(QFont) connect(fontcombo[0], SIGNAL(currentFontChanged(QFont)), this, SLOT(changedFont(const QFont &))); }
AppearanceConfigTab::AppearanceConfigTab(QWidget *parent, TabMode mode) : QWidget(parent), ui(new Ui::ChatWindowConfig) { m_groupChat = mode == GroupChat; ui->setupUi(this); m_demoChatHeader.setChatName(i18n("A demo chat")); m_demoChatHeader.setSourceName(i18n("Jabber")); m_demoChatHeader.setTimeOpened(QDateTime::currentDateTime()); m_demoChatHeader.setDestinationName(i18nc("Example email", "*****@*****.**")); m_demoChatHeader.setDestinationDisplayName(i18nc("Example name", "Ted")); m_demoChatHeader.setGroupChat(m_groupChat); ChatWindowStyleManager *manager = ChatWindowStyleManager::self(); connect(manager, SIGNAL(loadStylesFinished()), SLOT(onStylesLoaded())); //loading theme settings. loadTab(); connect(ui->chatView, SIGNAL(loadFinished(bool)), SLOT(sendDemoMessages())); connect(ui->styleComboBox, SIGNAL(activated(int)), SLOT(onStyleSelected(int))); connect(ui->variantComboBox, SIGNAL(activated(QString)), SLOT(onVariantSelected(QString))); connect(ui->showHeader, SIGNAL(clicked(bool)), SLOT(onShowHeaderChanged(bool))); connect(ui->customFontBox, SIGNAL(clicked(bool)), SLOT(onFontGroupChanged(bool))); connect(ui->fontFamily, SIGNAL(currentFontChanged(QFont)), SLOT(onFontFamilyChanged(QFont))); connect(ui->fontSize, SIGNAL(valueChanged(int)), SLOT(onFontSizeChanged(int))); connect(ui->showPresenceCheckBox, SIGNAL(stateChanged(int)), SLOT(onShowPresenceChangesChanged(int))); sendDemoMessages(); }
void QQuickAbstractFontDialog::setCurrentFont(const QFont &arg) { if (m_currentFont != arg) { m_currentFont = arg; emit currentFontChanged(); } }
void CIndicatorEditorMainWindow::_CreateToolBarFont() { QIntValidator* validator = NULL; // m_pToolBarText = addToolBar(tr("Font")); m_pComboBoxFont = new QFontComboBox(); QObject::connect(m_pComboBoxFont, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotCurrentFontChanged(QFont))); m_pComboBoxFontSize = new QComboBox(); m_pComboBoxFontSize->setEditable(true); for (int nIndex = 2; nIndex < 80; nIndex = nIndex + 2) { m_pComboBoxFontSize->addItem(QString().setNum(nIndex)); } validator = new QIntValidator(2, 80, this); m_pComboBoxFontSize->setValidator(validator); QObject::connect(m_pComboBoxFontSize, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotFontSizeChanged(QString))); m_pToolBarText->addWidget(m_pComboBoxFont); m_pToolBarText->addWidget(m_pComboBoxFontSize); m_pToolBarText->addAction(m_pActionBlod); m_pToolBarText->addAction(m_pActionItalic); m_pToolBarText->addAction(m_pActionUnderline); m_pToolBarText->addAction(m_pActionSetFontColor); }
QGroupBox *CardEditor::createTextItemBox(const QString &text, const QFont &font, int skip, BlackEdgeTextItem *item){ QGroupBox *box = new QGroupBox; QLineEdit *edit = new QLineEdit; QPushButton *font_button = new QPushButton(font.family()); QSpinBox *size_spinbox = new QSpinBox; size_spinbox->setRange(1, 96); QSpinBox *space_spinbox = new QSpinBox; space_spinbox->setRange(0, 100); edit->setObjectName("name"); size_spinbox->setObjectName("font"); space_spinbox->setObjectName("space"); QFormLayout *layout = new QFormLayout; layout->addRow(tr("Text"), edit); layout->addRow(tr("Font"), font_button); layout->addRow(tr("Line spacing"), space_spinbox); QFontDialog *font_dialog = new QFontDialog(this); setMapping(font_dialog, font_button); connect(edit, SIGNAL(textChanged(QString)), item, SLOT(setText(QString))); connect(font_dialog, SIGNAL(currentFontChanged(QFont)), item, SLOT(setFont(QFont))); connect(space_spinbox, SIGNAL(valueChanged(int)), item, SLOT(setSkip(int))); edit->setText(text); font_dialog->setCurrentFont(font); space_spinbox->setValue(skip); box->setLayout(layout); return box; }
// public QFontDatabase::WritingSystem writingSystem() const void tst_QFontComboBox::writingSystem() { QFETCH(QFontDatabase::WritingSystem, writingSystem); SubQFontComboBox box; QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont))); QFont currentFont = box.currentFont(); box.setWritingSystem(writingSystem); QCOMPARE(box.writingSystem(), writingSystem); QFontDatabase db; QStringList list = db.families(writingSystem); int c = list.count(); for (int i = 0; i < list.count(); ++i) { if (db.isPrivateFamily(list[i])) c--; } QCOMPARE(box.model()->rowCount(), c); if (list.count() == 0) QCOMPARE(box.currentFont(), QFont()); QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0); }
void Clock::createClockConfigurationInterface(KConfigDialog *parent) { //TODO: Make the size settable QWidget *widget = new QWidget(); ui.setupUi(widget); parent->addPage(widget, i18n("Appearance"), "view-media-visualization"); ui.secondsCheckbox->setChecked(m_showSeconds); ui.showTimeZone->setChecked(m_showTimezone); ui.plainClockFontBold->setChecked(m_plainClockFont.bold()); ui.plainClockFontItalic->setChecked(m_plainClockFont.italic()); ui.plainClockFont->setCurrentFont(m_plainClockFont); ui.useCustomColor->setChecked(m_useCustomColor); ui.plainClockColor->setColor(m_plainClockColor); ui.drawShadow->setChecked(m_drawShadow); ui.useCustomShadowColor->setChecked(m_useCustomShadowColor); ui.plainClockShadowColor->setColor(m_plainClockShadowColor); ui.configureDateFormats->setIcon( KIcon( "configure" ) ); QStringList dateStyles; dateStyles << i18nc("A kind of date representation", "No date") << i18nc("A kind of date representation", "Compact date") << i18nc("A kind of date representation", "Short date") << i18nc("A kind of date representation", "Long date") << i18nc("A kind of date representation", "ISO date"); ui.dateStyle->addItems(dateStyles); ui.dateStyle->setCurrentIndex(m_dateStyle); connect(ui.drawShadow, SIGNAL(toggled(bool)), this, SLOT(configDrawShadowToggled(bool))); connect(ui.configureDateFormats, SIGNAL(clicked()), this, SLOT(launchDateKcm())); configDrawShadowToggled(m_drawShadow); connect(ui.plainClockFont, SIGNAL(currentFontChanged(QFont)), parent, SLOT(settingsModified())); connect(ui.plainClockFontBold, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.plainClockFontItalic, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.useCustomColor, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.plainClockColor, SIGNAL(changed(QColor)), parent, SLOT(settingsModified())); connect(ui.drawShadow, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.useCustomShadowColor, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.plainClockShadowColor, SIGNAL(changed(QColor)), parent, SLOT(settingsModified())); connect(ui.showTimeZone, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.secondsCheckbox, SIGNAL(stateChanged(int)), parent, SLOT(settingsModified())); connect(ui.dateStyle, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified())); }
void QFontComboBox::setCurrentFont(const QFont &font) { Q_D(QFontComboBox); if (font != d->currentFont) { d->currentFont = font; emit currentFontChanged(d->currentFont); d->_q_updateModel(); } }
ContextPaneTextWidget::ContextPaneTextWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ContextPaneTextWidget), m_fontSizeTimer(-1) { ui->setupUi(this); ui->boldButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-bold"), QIcon(QLatin1String(":/qmldesigner/images/bold-h-icon.png")))); ui->italicButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-italic"), QIcon(QLatin1String(":/qmldesigner/images/italic-h-icon.png")))); ui->underlineButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-underline"), QIcon(QLatin1String(":/qmldesigner/images/underline-h-icon.png")))); ui->strikeoutButton->setIcon(QIcon::fromTheme(QLatin1String("format-text-strikethrough"), QIcon(QLatin1String(":/qmldesigner/images/strikeout-h-icon.png")))); ui->leftAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-left"), QIcon(QLatin1String(":/qmldesigner/images/alignmentleft-h-icon.png")))); ui->centerHAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-center"), QIcon(QLatin1String(":/qmldesigner/images/alignmentcenterh-h-icon.png")))); ui->rightAlignmentButton->setIcon(QIcon::fromTheme(QLatin1String("format-justify-right"), QIcon(QLatin1String(":/qmldesigner/images/alignmentright-h-icon.png")))); ui->centerVAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmentmiddle-h-icon.png"))); ui->bottomAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmentbottom-h-icon.png"))); ui->topAlignmentButton->setIcon(QIcon(QLatin1String(":/qmldesigner/images/alignmenttop-h-icon.png"))); ui->colorButton->setShowArrow(false); ui->textColorButton->setShowArrow(false); connect(ui->colorButton, SIGNAL(toggled(bool)), this, SLOT(onColorButtonToggled(bool))); connect(ui->textColorButton, SIGNAL(toggled(bool)), this, SLOT(onTextColorButtonToggled(bool))); ContextPaneWidget *parentContextWidget = qobject_cast<ContextPaneWidget*>(parentWidget()); connect(parentContextWidget->colorDialog(), SIGNAL(accepted(QColor)), this, SLOT(onColorDialogApplied(QColor))); connect(parentContextWidget->colorDialog(), SIGNAL(rejected()), this, SLOT(onColorDialogCancled())); connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onFontSizeChanged(int))); connect(ui->fontSizeSpinBox, SIGNAL(formatChanged()), this, SLOT(onFontFormatChanged())); connect(ui->boldButton, SIGNAL(toggled(bool)), this, SLOT(onBoldCheckedChanged(bool))); connect(ui->italicButton, SIGNAL(toggled(bool)), this, SLOT(onItalicCheckedChanged(bool))); connect(ui->underlineButton, SIGNAL(toggled(bool)), this, SLOT(onUnderlineCheckedChanged(bool))); connect(ui->strikeoutButton, SIGNAL(toggled(bool)), this, SLOT(onStrikeoutCheckedChanged(bool))); connect(ui->fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(onCurrentFontChanged(QFont))); connect(ui->centerHAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); connect(ui->leftAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); connect(ui->rightAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onHorizontalAlignmentChanged())); connect(ui->centerVAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); connect(ui->topAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); connect(ui->bottomAlignmentButton, SIGNAL(toggled(bool)), this, SLOT(onVerticalAlignmentChanged())); connect(ui->styleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onStyleComboBoxChanged(QString))); }
QT_CHARTS_USE_NAMESPACE PieChart::PieChart(QWidget *parent) : AbstractWidget(parent), ui(new Ui::PieChart) { ui->setupUi(this); chart = new QChart(); chart->setTitle( ui->titleEdit->text() ); QFont tFont = chart->titleFont(); tFont.setPointSizeF( 15 ); tFont.setBold( true ); chart->setTitleFont( tFont ); chart->setAnimationOptions( QChart::AllAnimations ); ui->chartView->setChart( chart ); ui->chartView->setRenderHint(QPainter::Antialiasing); connect(ui->idEdit, SIGNAL(textEdited(QString)), this, SLOT(setId(QString))); connect(ui->titleEdit, SIGNAL(textEdited(QString)), this, SLOT(setTitle(QString))); connect(ui->hPosSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->vPosSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->sizeFactorSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->startAngleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->endAngleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->holeSizeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->explodeSliceCheckBox, SIGNAL(stateChanged(int)), this, SLOT(settingsChanged())); connect(ui->animationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged())); connect(ui->themeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged())); connect(ui->antialiasingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(settingsChanged())); ui->legendDetachedParamGroup->setVisible(false); connect(ui->legendShowCheckBox, SIGNAL(stateChanged(int)), this, SLOT(settingsChanged())); connect(ui->legendBoldCheckBox, SIGNAL(clicked(bool)), this, SLOT(settingsChanged())); connect(ui->legendItalicCheckBox, SIGNAL(clicked(bool)), this, SLOT(settingsChanged())); connect(ui->legendUnderlineCheckBox, SIGNAL(clicked(bool)), this, SLOT(settingsChanged())); connect(ui->legendFontSizeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->legendFontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(settingsChanged())); connect(ui->legendPositionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged())); connect(ui->legendHPosSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->legendVPosSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->legendWidthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->legendHeightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->labelArmLengthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(settingsChanged())); connect(ui->labelPosComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged())); connect(ui->showLabelsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(settingsChanged())); }
void QFontComboBox::setCurrentFont(const QFont &font) { Q_D(QFontComboBox); if (font != d->currentFont) { d->currentFont = font; d->_q_updateModel(); if (d->currentFont == font) { //else the signal has already be emitted by _q_updateModel emit currentFontChanged(d->currentFont); } } }
QT_BEGIN_NAMESPACE MainWindow::MainWindow(const QString &customFont) { setupUi(this); pixelSize->setValue(QFontInfo(QFont()).pixelSize()); populateCharacterRanges(); { weightCombo->addItem(QLatin1String("Light"), QVariant(int(QFont::Light))); const int normalIdx = weightCombo->count(); weightCombo->addItem(QLatin1String("Normal"), QVariant(int(QFont::Normal))); weightCombo->addItem(QLatin1String("DemiBold"), QVariant(int(QFont::DemiBold))); weightCombo->addItem(QLatin1String("Bold"), QVariant(int(QFont::Bold))); weightCombo->addItem(QLatin1String("Black"), QVariant(int(QFont::Black))); weightCombo->setCurrentIndex(normalIdx); } QShortcut *sc = new QShortcut(Qt::ControlModifier + Qt::Key_A, this); connect(sc, SIGNAL(activated()), this, SLOT(on_selectAll_clicked())); sc = new QShortcut(Qt::ControlModifier + Qt::Key_D, this); connect(sc, SIGNAL(activated()), this, SLOT(on_deselectAll_clicked())); sc = new QShortcut(Qt::ControlModifier + Qt::Key_I, this); connect(sc, SIGNAL(activated()), this, SLOT(on_invertSelection_clicked())); QCompleter *completer = new QCompleter(this); completer->setModel(new QDirModel(this)); path->setCompleter(completer); path->setText(QDir::currentPath()); completer = new QCompleter(this); completer->setModel(new QDirModel(this)); sampleFile->setCompleter(completer); charCount->setText(QString()); if (!customFont.isEmpty()) addCustomFont(customFont); fontChanged(); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(fontChanged())); connect(pixelSize, SIGNAL(valueChanged(int)), this, SLOT(fontChanged())); connect(italic, SIGNAL(stateChanged(int)), this, SLOT(fontChanged())); connect(weightCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(fontChanged())); }
BasicSettingsPage::BasicSettingsPage(QWidget* parent) : QWidget(parent), block(false), model(0) { ui.setupUi(this); connect(ui.themeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateModel())); connect(ui.fontComboBox, SIGNAL(currentFontChanged(QFont)), SLOT(updateModel())); connect(ui.sizeSpinBox, SIGNAL(valueChanged(int)), SLOT(updateModel())); connect(ui.blockSpinBox, SIGNAL(valueChanged(int)), SLOT(updateModel())); connect(ui.timeStampEdit, SIGNAL(textEdited(QString)), SLOT(updateModel())); connect(ui.stripNicksCheckBox, SIGNAL(toggled(bool)), SLOT(updateModel())); connect(ui.hideEventsCheckBox, SIGNAL(toggled(bool)), SLOT(updateModel())); }
// protected void currentFontChanged(QFont const& f) void tst_QFontComboBox::currentFontChanged() { SubQFontComboBox box; QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont))); if (box.model()->rowCount() > 2) { QTest::keyPress(&box, Qt::Key_Down); QCOMPARE(spy0.count(), 1); QFont f( "Sans Serif" ); box.setCurrentFont(f); QCOMPARE(spy0.count(), 2); } else qWarning("Not enough fonts installed on test system. Consider adding some"); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QWidget *centralWidget=new QWidget; QLabel *fontLabel=new QLabel(tr("Font:")); fontCombo =new QFontComboBox; QLabel *sizeLabel =new QLabel(tr("Size:")); sizeCombo =new QComboBox; QLabel *styleLabel=new QLabel(tr("Style:")); styleCombo =new QComboBox; QLabel *fontMeringLabel=new Qlabel(tr("Automatic Font Mergint:")); fontMerging=new QCheckBox; fontMerging->setChecked(true); scrollArea =new QScrollArea; characterWidget =new characterWidget; scrollArea->setWidget(characterWidget); findStyles(fontCombo->currentData()); lineEdit=new QLineEdit; #ifndef QT_NO_CLIPBOARD QPushButton *clipboardButton =new QpushButton(tr("&To clipboard")); connect(fontCombo, SIGNAL(currentFontChanged(QFont)), this, SLOT(findStyles(QFont))); connect(fontCombo, SIGNAL(currentFontChanged(QFont)), this, SLOT(findSizes(QFont))); connect(fontCombo, SIGNAL(currentFontChanged(QFont)), characterWidget, SLOT(updateFont(QFont))); connect(sizeCombo, SIGNAL(currentIndexChanged(QString)), characterWidget, SLOT(updateSize(QString))); connect(styleCombo, SIGNAL(currentIndexChanged(QString)), characterWidget, SLOT(updateStyle(QString))); }
// public QFontComboBox::FontFilters fontFilters() const void tst_QFontComboBox::fontFilters() { QFETCH(QFontComboBox::FontFilters, fontFilters); SubQFontComboBox box; QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont))); QFont currentFont = box.currentFont(); box.setFontFilters(fontFilters); QCOMPARE(box.fontFilters(), fontFilters); QFontDatabase db; QStringList list = db.families(); int c = 0; const int scalableMask = (QFontComboBox::ScalableFonts | QFontComboBox::NonScalableFonts); const int spacingMask = (QFontComboBox::ProportionalFonts | QFontComboBox::MonospacedFonts); if((fontFilters & scalableMask) == scalableMask) fontFilters &= ~scalableMask; if((fontFilters & spacingMask) == spacingMask) fontFilters &= ~spacingMask; for (int i = 0; i < list.count(); ++i) { if (db.isPrivateFamily(list[i])) continue; if (fontFilters & QFontComboBox::ScalableFonts) { if (!db.isSmoothlyScalable(list[i])) continue; } else if (fontFilters & QFontComboBox::NonScalableFonts) { if (db.isSmoothlyScalable(list[i])) continue; } if (fontFilters & QFontComboBox::MonospacedFonts) { if (!db.isFixedPitch(list[i])) continue; } else if (fontFilters & QFontComboBox::ProportionalFonts) { if (db.isFixedPitch(list[i])) continue; } c++; } QCOMPARE(box.model()->rowCount(), c); if (c == 0) QCOMPARE(box.currentFont(), QFont()); QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0); }
//----------------------------------------------------------------------------- void ctkFontButton::setCurrentFont(const QFont& newFont) { Q_D(ctkFontButton); if (d->Font == newFont) { return; } d->Font = newFont; this->setFont(newFont); this->setText(newFont.family()); emit currentFontChanged(newFont); }
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; }
ArtisticTextShapeConfigWidget::ArtisticTextShapeConfigWidget(ArtisticTextTool *textTool) : m_textTool(textTool) { Q_ASSERT(m_textTool); widget.setupUi( this ); widget.bold->setDefaultAction(textTool->action("artistictext_font_bold")); widget.italic->setDefaultAction(textTool->action("artistictext_font_italic")); widget.superScript->setDefaultAction(textTool->action("artistictext_superscript")); widget.subScript->setDefaultAction(textTool->action("artistictext_subscript")); widget.anchorStart->setDefaultAction(textTool->action("artistictext_anchor_start")); widget.anchorMiddle->setDefaultAction(textTool->action("artistictext_anchor_middle")); widget.anchorEnd->setDefaultAction(textTool->action("artistictext_anchor_end")); widget.fontSize->setRange( 2, 1000 ); connect(widget.fontFamily, SIGNAL(currentFontChanged(QFont)), this, SIGNAL(fontFamilyChanged(QFont))); connect(widget.fontSize, SIGNAL(valueChanged(int)), this, SIGNAL(fontSizeChanged(int))); }
PreferencesDialog::PreferencesDialog(QSettings &_settings): settings(_settings) { ui.setupUi(this); settings.beginGroup("Editor"); QFont font; font.fromString(settings.value("Font", QFont("Courier New", 10).toString()).toString()); ui.font->setCurrentFont(QFont(font.family())); ui.size->setValue(font.pointSize()); settings.endGroup(); updateFontStyle(); connect(ui.font, SIGNAL(currentFontChanged(QFont)), this, SLOT(updateFontStyle())); connect(ui.size, SIGNAL(valueChanged(int)), this, SLOT(updateFontStyle())); show(); }
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; }
// public QFontDatabase::WritingSystem writingSystem() const void tst_QFontComboBox::writingSystem() { QFETCH(QFontDatabase::WritingSystem, writingSystem); SubQFontComboBox box; QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont))); QFont currentFont = box.currentFont(); box.setWritingSystem(writingSystem); QCOMPARE(box.writingSystem(), writingSystem); QFontDatabase db; QStringList list = db.families(writingSystem); QCOMPARE(box.model()->rowCount(), list.count()); if (list.count() == 0) QCOMPARE(box.currentFont(), QFont()); QCOMPARE(spy0.count(), (currentFont != box.currentFont()) ? 1 : 0); }
/*! 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(); }
FontDialog::FontDialog(const QFont &f) : QDialog(0) { setupUi(this); fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::NonScalableFonts | QFontComboBox::ScalableFonts); fontComboBox->setCurrentFont(f); fontComboBox->setEditable(false); sizeSpinBox->setValue(f.pointSize()); setFontSample(); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(setFontSample())); connect(sizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setFontSample())); }