mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 12:39:41 +00:00
Added uncheck all function
This commit is contained in:
parent
a321685e7a
commit
c68a4743bd
2 changed files with 21 additions and 5 deletions
|
@ -309,7 +309,7 @@ void DataFilesPage::setCheckstate(QModelIndex index)
|
|||
}
|
||||
}
|
||||
|
||||
const QStringList DataFilesPage::checkedItems()
|
||||
const QStringList DataFilesPage::checkedPlugins()
|
||||
{
|
||||
QStringList checkedItems;
|
||||
|
||||
|
@ -326,6 +326,21 @@ const QStringList DataFilesPage::checkedItems()
|
|||
return checkedItems;
|
||||
}
|
||||
|
||||
void DataFilesPage::uncheckPlugins()
|
||||
{
|
||||
for (int r=0; r<mPluginsModel->rowCount(); ++r ) {
|
||||
QModelIndex index = mPluginsModel->index(r, 0);
|
||||
|
||||
if (index.isValid()) {
|
||||
// See if the current item is checked
|
||||
if (mPluginsModel->data(index, Qt::CheckStateRole) == Qt::Checked) {
|
||||
mPluginsModel->setData(index, Qt::Unchecked, Qt::CheckStateRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DataFilesPage::resizeRows()
|
||||
{
|
||||
// Contents changed
|
||||
|
@ -348,11 +363,11 @@ void DataFilesPage::writeConfig()
|
|||
}
|
||||
|
||||
// Now write all checked plugins
|
||||
const QStringList checkedPlugins = checkedItems();
|
||||
const QStringList plugins = checkedPlugins();
|
||||
|
||||
for (int i = 0; i < checkedPlugins.size(); ++i)
|
||||
for (int i = 0; i < plugins.size(); ++i)
|
||||
{
|
||||
settings.setValue(QString("Plugin%1").arg(i), checkedPlugins.at(i));
|
||||
settings.setValue(QString("Plugin%1").arg(i), plugins.at(i));
|
||||
}
|
||||
|
||||
settings.endGroup();
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
QComboBox *mProfileComboBox;
|
||||
QStringListModel *mProfileModel;
|
||||
|
||||
const QStringList checkedItems();
|
||||
const QStringList checkedPlugins();
|
||||
void writeConfig();
|
||||
|
||||
public slots:
|
||||
|
@ -42,6 +42,7 @@ private:
|
|||
void setupDataFiles();
|
||||
void addPlugins(const QModelIndex &index);
|
||||
void removePlugins(const QModelIndex &index);
|
||||
void uncheckPlugins();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue