mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 15:39:41 +00:00
Added a function which returns the checked plugin names
This commit is contained in:
parent
c17eed26f3
commit
de78b81a8f
2 changed files with 23 additions and 1 deletions
|
@ -241,6 +241,7 @@ void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::addPlugins(const QModelIndex &index)
|
void DataFilesPage::addPlugins(const QModelIndex &index)
|
||||||
|
@ -251,10 +252,11 @@ void DataFilesPage::addPlugins(const QModelIndex &index)
|
||||||
|
|
||||||
for (int r=0; r<mDataFilesModel->rowCount(index); ++r ) {
|
for (int r=0; r<mDataFilesModel->rowCount(index); ++r ) {
|
||||||
QModelIndex childIndex = index.child(r, 0);
|
QModelIndex childIndex = index.child(r, 0);
|
||||||
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
|
|
||||||
|
|
||||||
if (childIndex.isValid()) {
|
if (childIndex.isValid()) {
|
||||||
// Now we see if the pluginsmodel already contains this plugin
|
// Now we see if the pluginsmodel already contains this plugin
|
||||||
|
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
|
||||||
|
|
||||||
QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
|
QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
|
||||||
|
|
||||||
if (itemList.isEmpty())
|
if (itemList.isEmpty())
|
||||||
|
@ -307,8 +309,26 @@ void DataFilesPage::setCheckstate(QModelIndex index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QStringList DataFilesPage::checkedItems()
|
||||||
|
{
|
||||||
|
QStringList checkedItems;
|
||||||
|
|
||||||
|
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) {
|
||||||
|
checkedItems.append(index.data().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return checkedItems;
|
||||||
|
}
|
||||||
|
|
||||||
void DataFilesPage::resizeRows()
|
void DataFilesPage::resizeRows()
|
||||||
{
|
{
|
||||||
// Contents changed
|
// Contents changed
|
||||||
mPluginsTable->resizeRowsToContents();
|
mPluginsTable->resizeRowsToContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ public slots:
|
||||||
void setCheckstate(QModelIndex index);
|
void setCheckstate(QModelIndex index);
|
||||||
void resizeRows();
|
void resizeRows();
|
||||||
|
|
||||||
|
const QStringList checkedItems();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTableWidget *mMastersWidget;
|
QTableWidget *mMastersWidget;
|
||||||
QTableView *mPluginsTable;
|
QTableView *mPluginsTable;
|
||||||
|
|
Loading…
Reference in a new issue