1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-20 15:40:32 +00:00

Added a function which returns the checked plugin names

This commit is contained in:
Pieter van der Kloet 2011-04-24 22:05:33 +02:00
parent c17eed26f3
commit de78b81a8f
2 changed files with 23 additions and 1 deletions

View File

@ -241,6 +241,7 @@ void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const
}
}
}
}
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 ) {
QModelIndex childIndex = index.child(r, 0);
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
if (childIndex.isValid()) {
// Now we see if the pluginsmodel already contains this plugin
const QString childIndexData = QVariant(mDataFilesModel->data(childIndex)).toString();
QList<QStandardItem *> itemList = mPluginsModel->findItems(childIndexData);
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()
{
// Contents changed
mPluginsTable->resizeRowsToContents();
}

View File

@ -27,6 +27,8 @@ public slots:
void setCheckstate(QModelIndex index);
void resizeRows();
const QStringList checkedItems();
private:
QTableWidget *mMastersWidget;
QTableView *mPluginsTable;