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());
46 this->updateFont(fontTmp);
49 void FontButton::updateAppearance()
51 QString text = QString(
"%1, %2").arg(this->currentFont.family()).arg(this->currentFont.pointSize());
52 QFont textFont = this->currentFont;
54 this->setFont(textFont);
60 QFont oldFont = this->currentFont;
61 this->currentFont = newFont;
64 emit fontUpdated(oldFont, this->currentFont);