Add support for FontSelector in SettingsPage::hasChanged(), allowing
one to easily test if a specific font selector has changed since last
save.
This allows for optimizing stylesheet updates to only happen when
relevant settings are changed.
#include <QSpinBox>
#include <QVariant>
#include <QSpinBox>
#include <QVariant>
+#include "fontselector.h"
+
#include "uisettings.h"
SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
#include "uisettings.h"
SettingsPage::SettingsPage(const QString &category, const QString &title, QWidget *parent)
{
return box->property("storedValue").toInt() != box->value();
}
{
return box->property("storedValue").toInt() != box->value();
}
+
+
+void SettingsPage::load(FontSelector *box, QFont value)
+{
+ box->setProperty("storedValue", value);
+ box->setSelectedFont(value);
+}
+
+
+bool SettingsPage::hasChanged(FontSelector *box)
+{
+ return box->property("storedValue").value<QFont>() != box->selectedFont();
class QCheckBox;
class QComboBox;
class QSpinBox;
class QCheckBox;
class QComboBox;
class QSpinBox;
//! A SettingsPage is a page in the settings dialog.
/** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
//! A SettingsPage is a page in the settings dialog.
/** The SettingsDlg provides suitable standard buttons, such as Ok, Apply, Cancel, Restore Defaults and Reset.
static bool hasChanged(QComboBox *box);
static void load(QSpinBox *box, int value);
static bool hasChanged(QSpinBox *box);
static bool hasChanged(QComboBox *box);
static void load(QSpinBox *box, int value);
static bool hasChanged(QSpinBox *box);
+ static void load(FontSelector *box, QFont value);
+ static bool hasChanged(FontSelector *box);
public slots:
//! Save settings to permanent storage.
public slots:
//! Save settings to permanent storage.