diff options
Diffstat (limited to 'src/libaudqt/prefs-widget.h')
-rw-r--r-- | src/libaudqt/prefs-widget.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/libaudqt/prefs-widget.h b/src/libaudqt/prefs-widget.h index f4deb4f..773945a 100644 --- a/src/libaudqt/prefs-widget.h +++ b/src/libaudqt/prefs-widget.h @@ -68,6 +68,19 @@ private: SmartPtr<HookReceiver<HookableWidget>> hook; }; +/* shared class which allows disabling child widgets */ +class ParentWidget : public HookableWidget { +public: + void set_child_layout (QLayout * layout) + { m_child_layout = layout; } + +protected: + ParentWidget (const PreferencesWidget * parent, const char * domain) : + HookableWidget (parent, domain) {} + + QLayout * m_child_layout = nullptr; +}; + /* button widget */ class ButtonWidget : public QPushButton { public: @@ -75,16 +88,11 @@ public: }; /* boolean widget (checkbox) */ -class BooleanWidget : public QCheckBox, public HookableWidget { +class BooleanWidget : public QCheckBox, public ParentWidget { public: BooleanWidget (const PreferencesWidget * parent, const char * domain); - - void set_child_layout (QLayout * layout) - { m_child_layout = layout; } - private: void update (); - QLayout * m_child_layout = nullptr; }; /* integer widget (spinner) */ @@ -97,7 +105,7 @@ private: }; /* integer widget (radio button) */ -class RadioButtonWidget : public QRadioButton, HookableWidget { +class RadioButtonWidget : public QRadioButton, public ParentWidget { public: RadioButtonWidget (const PreferencesWidget * parent, const char * domain, QButtonGroup * btn_group); |