summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gilg <subdiff@gmail.com>2017-01-16 18:11:07 (GMT)
committerRoman Gilg <subdiff@gmail.com>2017-01-16 18:11:07 (GMT)
commite019c9f61edf20c433ac4bf2e3546ce9b5c1104a (patch)
treee598be7c66d2431022c8edd1aa92adea7c581ab4
parent4d3809f8e314b602e566ba42469ca3a0836b3e88 (diff)
[TabBox] Remember current model index on SwitcherItem model set
In case we need to set the SwitcherItem model in `TabBoxHandlerPrivate::show()`, remember the current index row, otherwise it gets reset to the first item. Reviewers: #kwin, graesslin Tags: #kwin Differential Revision: https://phabricator.kde.org/D4162 BUG: 333511
-rw-r--r--tabbox/tabboxhandler.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp
index 9068174..afaf5a1 100644
--- a/tabbox/tabboxhandler.cpp
+++ b/tabbox/tabboxhandler.cpp
@@ -323,6 +323,9 @@ void TabBoxHandlerPrivate::show()
}
}
if (SwitcherItem *item = switcherItem()) {
+ // In case the model isn't yet set (see below), index will be reset and therefore we
+ // need to save the current index row (https://bugs.kde.org/show_bug.cgi?id=333511).
+ int indexRow = index.row();
if (!item->model()) {
QAbstractItemModel *model = nullptr;
if (desktopMode) {
@@ -333,7 +336,7 @@ void TabBoxHandlerPrivate::show()
item->setModel(model);
}
item->setAllDesktops(config.clientDesktopMode() == TabBoxConfig::AllDesktopsClients);
- item->setCurrentIndex(index.row());
+ item->setCurrentIndex(indexRow);
// everything is prepared, so let's make the whole thing visible
item->setVisible(true);
}