diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-27 12:01:38 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-07-02 10:10:19 -0400 |
| commit | 6547197e5f685439371446b499427848ed687871 (patch) | |
| tree | 37252c30bee360222c880979d7b8437e64135196 /src/modinfodialogtab.h | |
| parent | e1990df0a2f25b4ac9227655fd5d597cf8ab6cf4 (diff) | |
remember state of various widgets
remove obsolete settings
Diffstat (limited to 'src/modinfodialogtab.h')
| -rw-r--r-- | src/modinfodialogtab.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modinfodialogtab.h b/src/modinfodialogtab.h index 058035ab..ce29c868 100644 --- a/src/modinfodialogtab.h +++ b/src/modinfodialogtab.h @@ -67,6 +67,23 @@ protected: void emitModOpen(QString name); void setHasData(bool b); + // this needs to be a template because saveState() and restoreState() are + // not in QWidget, but they're in various widgets + // + template <class Widget> + void saveWidgetState(QSettings& s, Widget* w) + { + s.setValue(settingName(w), w->saveState()); + } + + template <class Widget> + void restoreWidgetState(const QSettings& s, Widget* w) + { + if (s.contains(settingName(w))) { + w->restoreState(s.value(settingName(w)).toByteArray()); + } + } + private: OrganizerCore& m_core; PluginContainer& m_plugin; @@ -76,6 +93,12 @@ private: int m_tabID; bool m_hasData; bool m_firstActivation; + + + QString settingName(QWidget* w) + { + return "geometry/modinfodialog_" + w->objectName(); + } }; |
