forked from teamnwah/openmw-tes3coop
Fixed checkboxes saving invalid values.
This commit is contained in:
parent
fc8d6da6a2
commit
48f96df29d
2 changed files with 12 additions and 5 deletions
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
CSVSettings::BooleanView::BooleanView (CSMSettings::Setting *setting,
|
CSVSettings::BooleanView::BooleanView (CSMSettings::Setting *setting,
|
||||||
Page *parent)
|
Page *parent)
|
||||||
: View (setting, parent)
|
: mType(setting->type()), View (setting, parent)
|
||||||
{
|
{
|
||||||
foreach (const QString &value, setting->declaredValues())
|
foreach (const QString &value, setting->declaredValues())
|
||||||
{
|
{
|
||||||
QAbstractButton *button = 0;
|
QAbstractButton *button = 0;
|
||||||
|
|
||||||
switch (setting->type())
|
switch (mType)
|
||||||
{
|
{
|
||||||
case CSMSettings::Type_CheckBox: {
|
case CSMSettings::Type_CheckBox: {
|
||||||
if(mButtons.empty()) // show only one for checkboxes
|
if(mButtons.empty()) // show only one for checkboxes
|
||||||
|
@ -43,7 +43,7 @@ CSVSettings::BooleanView::BooleanView (CSMSettings::Setting *setting,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(setting->type() != CSMSettings::Type_CheckBox || mButtons.empty())
|
if(mType != CSMSettings::Type_CheckBox || mButtons.empty())
|
||||||
{
|
{
|
||||||
connect (button, SIGNAL (clicked (bool)),
|
connect (button, SIGNAL (clicked (bool)),
|
||||||
this, SLOT (slotToggled (bool)));
|
this, SLOT (slotToggled (bool)));
|
||||||
|
@ -67,8 +67,14 @@ void CSVSettings::BooleanView::slotToggled (bool state)
|
||||||
|
|
||||||
foreach (QString key, mButtons.keys())
|
foreach (QString key, mButtons.keys())
|
||||||
{
|
{
|
||||||
if (mButtons.value(key)->isChecked())
|
// checkbox values are true/false unlike radio buttons
|
||||||
values.append (key);
|
if(mType == CSMSettings::Type_CheckBox)
|
||||||
|
values.append(mButtons.value(key)->isChecked() ? "true" : "false");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mButtons.value(key)->isChecked())
|
||||||
|
values.append (key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setSelectedValues (values, false);
|
setSelectedValues (values, false);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace CSVSettings
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
QMap <QString, QAbstractButton *> mButtons;
|
QMap <QString, QAbstractButton *> mButtons;
|
||||||
|
enum CSMSettings::SettingType mType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BooleanView (CSMSettings::Setting *setting,
|
explicit BooleanView (CSMSettings::Setting *setting,
|
||||||
|
|
Loading…
Reference in a new issue