forked from teamnwah/openmw-tes3coop
Removed isChecked function, can be done with less code
This commit is contained in:
parent
410229e521
commit
6feaac3d6f
2 changed files with 9 additions and 15 deletions
|
@ -584,7 +584,15 @@ void DataFilesPage::showContextMenu(const QPoint &point)
|
||||||
foreach (const QModelIndex ¤tIndex, selectedIndexes) {
|
foreach (const QModelIndex ¤tIndex, selectedIndexes) {
|
||||||
if (currentIndex.isValid()) {
|
if (currentIndex.isValid()) {
|
||||||
|
|
||||||
if (isChecked(currentIndex)) {
|
const QModelIndex sourceIndex = mPluginsProxyModel->mapToSource(currentIndex);
|
||||||
|
|
||||||
|
if (!sourceIndex.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStandardItem *currentItem = mPluginsModel->itemFromIndex(sourceIndex);
|
||||||
|
|
||||||
|
if (currentItem->checkState() == Qt::Checked) {
|
||||||
mUncheckAction->setEnabled(true);
|
mUncheckAction->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
mCheckAction->setEnabled(true);
|
mCheckAction->setEnabled(true);
|
||||||
|
@ -746,19 +754,6 @@ void DataFilesPage::setCheckState(QModelIndex index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataFilesPage::isChecked(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
|
|
||||||
QModelIndex sourceModelIndex = mPluginsProxyModel->mapToSource(index);
|
|
||||||
|
|
||||||
if (mPluginsModel->data(sourceModelIndex, Qt::CheckStateRole) == Qt::Checked) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const QStringList DataFilesPage::selectedMasters()
|
const QStringList DataFilesPage::selectedMasters()
|
||||||
{
|
{
|
||||||
QStringList masters;
|
QStringList masters;
|
||||||
|
|
|
@ -86,7 +86,6 @@ private:
|
||||||
void uncheckPlugins();
|
void uncheckPlugins();
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|
||||||
bool isChecked(const QModelIndex &index);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue