summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-08-04 22:57:16 +0200
committerPetr Mrázek <peterix@gmail.com>2016-08-04 22:57:16 +0200
commit6ec2652b4562119ccf45d3bc455ef865fdfbd3ce (patch)
tree908d1d7155c68b7960ea14b5d1e7803ecf97e0b3 /application
parenteec87db86a8a00db0a9145a3b17c53408f7b1f5b (diff)
downloadMultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.gz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.lz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.tar.xz
MultiMC-6ec2652b4562119ccf45d3bc455ef865fdfbd3ce.zip
GH-1273 allow extended selection in mod lists
Diffstat (limited to 'application')
-rw-r--r--application/pages/ModFolderPage.cpp15
-rw-r--r--application/widgets/ModListView.cpp2
2 files changed, 3 insertions, 14 deletions
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index 3926fc46..a1d02ccf 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -167,19 +167,8 @@ void ModFolderPage::on_addModBtn_clicked()
void ModFolderPage::on_rmModBtn_clicked()
{
- int first, last;
- auto list = ui->modTreeView->selectionModel()->selectedRows();
-
- if (!lastfirst(list, first, last))
- return;
-
- QVector<int> toDelete;
- for(int i = first; i <= last; i++)
- {
- auto index = m_filterModel->mapToSource(m_filterModel->index(i,0,QModelIndex()));
- toDelete.append(index.row());
- }
- m_mods->deleteMods(toDelete);
+ auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
+ m_mods->deleteMods(selection.indexes());
}
void ModFolderPage::on_viewModBtn_clicked()
diff --git a/application/widgets/ModListView.cpp b/application/widgets/ModListView.cpp
index 51b4a475..90c6f798 100644
--- a/application/widgets/ModListView.cpp
+++ b/application/widgets/ModListView.cpp
@@ -28,7 +28,7 @@ ModListView::ModListView ( QWidget* parent )
setRootIsDecorated ( false );
setSortingEnabled ( false );
setAlternatingRowColors ( true );
- setSelectionMode ( QAbstractItemView::ContiguousSelection );
+ setSelectionMode ( QAbstractItemView::ExtendedSelection );
setHeaderHidden ( false );
setSelectionBehavior(QAbstractItemView::SelectRows);
setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn );