FontPickerButton::FontPickerButton(const QIcon &i, const QString &t, QWidget *p, const QFont &iF) : QPushButton(i, t, p), selectedFont(QFont()) { setSelectedFont(iF); QObject::connect(this, SIGNAL(clicked()), this, SLOT(doClicked())); }
void FontPickerButton::doClicked() { bool ok; setSelectedFont(QFontDialog::getFont(&ok, getSelectedFont(), this, tr("Select a Font"), nullptr)); if(ok) Q_EMIT selectedFontChanged(getSelectedFont()); }
/** * This methods tries to set the font * @param f The wishes font * @return success or failure */ bool OFontSelector::setSelectedFont ( const QFont &f ) { return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); }
FontPickerButton::FontPickerButton(QWidget *p, const QFont &iF) : QPushButton(tr("Select a Font"), p), selectedFont(QFont()) { setSelectedFont(iF); QObject::connect(this, SIGNAL(clicked()), this, SLOT(doClicked())); }