Gui: add new PrefCheckableGroupBox widget
This commit is contained in:
@@ -864,4 +864,37 @@ void PrefFontBox::savePreferences()
|
||||
getWindowParameter()->SetASCII(entryName(), currName.toUtf8());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
PrefCheckableGroupBox::PrefCheckableGroupBox(QWidget* parent)
|
||||
: QGroupBox(parent), PrefWidget()
|
||||
{
|
||||
}
|
||||
|
||||
PrefCheckableGroupBox::~PrefCheckableGroupBox() = default;
|
||||
|
||||
void PrefCheckableGroupBox::restorePreferences()
|
||||
{
|
||||
if (getWindowParameter().isNull() || entryName().isEmpty()) {
|
||||
failedToRestore(objectName());
|
||||
return;
|
||||
}
|
||||
|
||||
// Default value is the current state of the checkbox (usually from .ui on first load)
|
||||
bool defaultValueInUi = isChecked();
|
||||
bool actualValue = getWindowParameter()->GetBool(entryName(), defaultValueInUi);
|
||||
setChecked(actualValue);
|
||||
}
|
||||
|
||||
void PrefCheckableGroupBox::savePreferences()
|
||||
{
|
||||
if (getWindowParameter().isNull() || entryName().isEmpty())
|
||||
{
|
||||
failedToSave(objectName());
|
||||
return;
|
||||
}
|
||||
|
||||
getWindowParameter()->SetBool(entryName(), isChecked());
|
||||
}
|
||||
|
||||
#include "moc_PrefWidgets.cpp"
|
||||
|
||||
Reference in New Issue
Block a user