MiniQtHelper: Add getteer and setter for CollapseGroupBox;

This commit is contained in:
KenLee
2023-02-03 11:35:38 +08:00
committed by Baldur Karlsson
parent d20fa1c17d
commit 2eddf80770
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -819,7 +819,7 @@ If you want a default radio box to be checked, you should use :meth:`SetWidgetCh
virtual QWidget *CreateRadiobox(WidgetCallback changed) = 0;
DOCUMENT(R"(Set whether the widget is checked or not. This only affects checkboxes and radio
boxes. If another type of widget is passed nothing will happen.
boxes and group box. If another type of widget is passed nothing will happen.
:param QWidget checkableWidget: The widget to check or uncheck.
:param bool checked: ``True`` if the widget should be checked.
@@ -827,7 +827,7 @@ boxes. If another type of widget is passed nothing will happen.
virtual void SetWidgetChecked(QWidget *checkableWidget, bool checked) = 0;
DOCUMENT(R"(Return the current checked-state of a widget. See :meth:`SetWidgetChecked`. If another
type of widget is passed other than a checkbox or radio box ``False`` will be returned.
type of widget is passed other than a checkbox or radio box or group box ``False`` will be returned.
:param QWidget checkableWidget: The widget to query.
:return: ``True`` if the widget is currently checked.
+6
View File
@@ -590,11 +590,14 @@ void MiniQtHelper::SetWidgetChecked(QWidget *checkableWidget, bool checked)
QCheckBox *check = qobject_cast<QCheckBox *>(checkableWidget);
QRadioButton *radio = qobject_cast<QRadioButton *>(checkableWidget);
CollapseGroupBox *group = qobject_cast<CollapseGroupBox *>(checkableWidget);
if(check)
check->setChecked(checked);
else if(radio)
radio->setChecked(checked);
else if(group)
group->setCollapsed(checked);
}
bool MiniQtHelper::IsWidgetChecked(QWidget *checkableWidget)
@@ -604,11 +607,14 @@ bool MiniQtHelper::IsWidgetChecked(QWidget *checkableWidget)
QCheckBox *check = qobject_cast<QCheckBox *>(checkableWidget);
QRadioButton *radio = qobject_cast<QRadioButton *>(checkableWidget);
CollapseGroupBox *group = qobject_cast<CollapseGroupBox *>(checkableWidget);
if(check)
return check->isChecked();
else if(radio)
return radio->isChecked();
else if(group)
return group->collapsed();
return false;
}