23 #include "fontbutton.h" 24 #include <QFontDialog> 26 FontButton::FontButton(QWidget* parent)
29 connect(
this, SIGNAL( clicked() ), SLOT( thisClicked() ) );
31 this->updateAppearance();
34 void FontButton::setSelectedFont(
const QFont& font)
36 this->currentFont = font;
37 this->updateAppearance();
40 void FontButton::thisClicked()
43 QFont fontTmp = QFontDialog::getFont(&bOk, this->currentFont, this->parentWidget());
47 this->updateFont(fontTmp);
51 void FontButton::updateAppearance()
53 QString text = QString(
"%1, %2").arg(this->currentFont.family()).arg(this->currentFont.pointSize());
54 QFont textFont = this->currentFont;
56 this->setFont(textFont);
62 QFont oldFont = this->currentFont;
63 this->currentFont = newFont;
66 emit fontUpdated(oldFont, this->currentFont);