diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-08-27 17:23:55 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-09-23 13:28:02 +0000 |
commit | 47e4ae86a8d87ec6388d9423aba86d1498b49012 (patch) | |
tree | 697a90c9e0d3e2213b054dd3a2ad21f9883d99e2 /examples/widgets/tools/settingseditor/mainwindow.h | |
parent | 2e02130e394083f8bc7fa04a8e0b6e0c0ed4e1b2 (diff) |
Polish the settings editor example.
- Set QtProject as organization.
- Remove unneeded member variables.
- Use member initialization in the constructor.
- Use new connection syntax in createActions()
to assemble the menu there, removing the createMenus()
function.
- Introduce a QSharedPointer to ensure settings are deleted.
Previously, the settings were parented on the tree widget,
which is a hack of sorts.
- Fix OS X macros.
Change-Id: Ibbc6bfb03eb5c7eda077b1a3aa3f1707667f7f13
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'examples/widgets/tools/settingseditor/mainwindow.h')
-rw-r--r-- | examples/widgets/tools/settingseditor/mainwindow.h | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/examples/widgets/tools/settingseditor/mainwindow.h b/examples/widgets/tools/settingseditor/mainwindow.h index 55180c3771..4b1a28dfba 100644 --- a/examples/widgets/tools/settingseditor/mainwindow.h +++ b/examples/widgets/tools/settingseditor/mainwindow.h @@ -42,10 +42,10 @@ #define MAINWINDOW_H #include <QMainWindow> +#include <QSharedPointer> QT_BEGIN_NAMESPACE class QAction; -class QMenu; class QSettings; QT_END_NAMESPACE class LocationDialog; @@ -56,6 +56,8 @@ class MainWindow : public QMainWindow Q_OBJECT public: + typedef QSharedPointer<QSettings> SettingsPtr; + MainWindow(); private slots: @@ -67,25 +69,13 @@ private slots: private: void createActions(); - void createMenus(); - void setSettingsObject(QSettings *settings); + void setSettingsObject(const SettingsPtr &settings); SettingsTree *settingsTree; LocationDialog *locationDialog; - - QMenu *fileMenu; - QMenu *optionsMenu; - QMenu *helpMenu; - QAction *openSettingsAct; - QAction *openIniFileAct; - QAction *openPropertyListAct; - QAction *openRegistryPathAct; QAction *refreshAct; - QAction *exitAct; QAction *autoRefreshAct; QAction *fallbacksAct; - QAction *aboutAct; - QAction *aboutQtAct; }; #endif |