From: Manuel Nickschas Date: Tue, 4 Aug 2009 07:42:46 +0000 (+0200) Subject: Remove label from FontSelector X-Git-Tag: 0.5-rc1~87 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=8040de61d6bb8a1fa5388827efd6037cb6feed8e Remove label from FontSelector Earlier the FontSelector had its own label, which in retrospect was a stupid idea. Much better to just consider the demo widget and choose button parts of the FontSelector widget and have settingspages supply their own description label - or checkbox. This makes it much easier to have a font disableable, without introducing the need for multi-property autowidgets. --- diff --git a/src/uisupport/fontselector.cpp b/src/uisupport/fontselector.cpp index 8a53551b..457c1d9b 100644 --- a/src/uisupport/fontselector.cpp +++ b/src/uisupport/fontselector.cpp @@ -27,19 +27,10 @@ #include "fontselector.h" FontSelector::FontSelector(QWidget *parent) : QWidget(parent) { - init(); -} - -FontSelector::FontSelector(const QString &label, QWidget *parent) : QWidget(parent) { - init(label); -} - -void FontSelector::init(const QString &label) { QHBoxLayout *layout = new QHBoxLayout(this); QPushButton *chooseButton = new QPushButton(tr("Choose..."), this); connect(chooseButton, SIGNAL(clicked()), SLOT(chooseFont())); - layout->addWidget(_label = new QLabel(label)); layout->addWidget(_demo = new QLabel("Font")); layout->addWidget(chooseButton); layout->setContentsMargins(0, 0, 0, 0); @@ -50,10 +41,6 @@ void FontSelector::init(const QString &label) { _font = font(); } -void FontSelector::setText(const QString &label) { - _label->setText(label); -} - void FontSelector::setSelectedFont(const QFont &font) { _font = font; _demo->setText(QString("%1 %2pt").arg(font.family()).arg(font.pointSize())); diff --git a/src/uisupport/fontselector.h b/src/uisupport/fontselector.h index 60d27776..378bf296 100644 --- a/src/uisupport/fontselector.h +++ b/src/uisupport/fontselector.h @@ -27,17 +27,13 @@ class FontSelector : public QWidget { Q_OBJECT Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) - Q_PROPERTY(QString text READ text WRITE setText) public: FontSelector(QWidget *parent = 0); - FontSelector(const QString &label, QWidget *parent = 0); inline const QFont &selectedFont() const { return _font; } - inline QString text() const { return _label->text(); } public slots: - void setText(const QString &label); void setSelectedFont(const QFont &font); signals: @@ -51,9 +47,7 @@ protected slots: private: QFont _font; - QLabel *_demo, *_label; - - void init(const QString &label = "Font"); + QLabel *_demo; }; #endif // FONTSELECTOR_H_