mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
ExtendedCommandConfigurator: disable the perform button when all tables are unchecked
This commit is contained in:
parent
260f6f22ae
commit
95d16b24c0
@ -28,6 +28,7 @@ CSVWorld::ExtendedCommandConfigurator::ExtendedCommandConfigurator(CSMDoc::Docum
|
||||
QWidget *parent)
|
||||
: QWidget(parent),
|
||||
mNumUsedCheckBoxes(0),
|
||||
mNumChecked(0),
|
||||
mMode(Mode_None)
|
||||
{
|
||||
mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this);
|
||||
@ -125,7 +126,9 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector<CS
|
||||
{
|
||||
for (int i = numTypes - numCheckBoxes; i > 0; --i)
|
||||
{
|
||||
mTypeCheckBoxes.insert(std::make_pair(new QCheckBox(mTypeGroup), CSMWorld::UniversalId::Type_None));
|
||||
QCheckBox *checkBox = new QCheckBox(mTypeGroup);
|
||||
connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(checkBoxStateChanged(int)));
|
||||
mTypeCheckBoxes.insert(std::make_pair(checkBox, CSMWorld::UniversalId::Type_None));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +151,7 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector<CS
|
||||
current->first->hide();
|
||||
}
|
||||
}
|
||||
mNumUsedCheckBoxes = numTypes;
|
||||
mNumChecked = mNumUsedCheckBoxes = numTypes;
|
||||
}
|
||||
|
||||
void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
||||
@ -176,3 +179,20 @@ void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
||||
}
|
||||
emit done();
|
||||
}
|
||||
|
||||
void CSVWorld::ExtendedCommandConfigurator::checkBoxStateChanged(int state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case Qt::Unchecked:
|
||||
--mNumChecked;
|
||||
break;
|
||||
case Qt::Checked:
|
||||
++mNumChecked;
|
||||
break;
|
||||
case Qt::PartiallyChecked: // Not used
|
||||
break;
|
||||
}
|
||||
|
||||
mPerformButton->setEnabled(mNumChecked > 0);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ namespace CSVWorld
|
||||
QGroupBox *mTypeGroup;
|
||||
CheckBoxMap mTypeCheckBoxes;
|
||||
int mNumUsedCheckBoxes;
|
||||
int mNumChecked;
|
||||
|
||||
Mode mMode;
|
||||
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
||||
@ -59,6 +60,7 @@ namespace CSVWorld
|
||||
|
||||
private slots:
|
||||
void performExtendedCommand();
|
||||
void checkBoxStateChanged(int state);
|
||||
|
||||
signals:
|
||||
void done();
|
||||
|
Loading…
x
Reference in New Issue
Block a user