┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRafael Fernández López <[email protected]>2007-12-14 19:20:47 +0000
committerRafael Fernández López <[email protected]>2007-12-14 19:20:47 +0000
commite983e0e38e43a93de158e105d6a18900521a2803 (patch)
treed71bb9bb4c03a648a408ba0b26f3425b3b92c4c8 /src
parent609ce0929289f3e26eb1898b184c7dafbf7bcac2 (diff)
Very interesting bug in Qt in which I will debug. For now, and since we need to release with the source version of Qt (not patched) we need this workaround. The problem
is that when you select by dragging with a rect a set of items, say (1, 2, 3) and you Ctrl+drag another set (5,6) the (1,2,3) selection is lost. If you do the same, that is: select (1, 2, 3), now Ctrl+click on (4), it is not lost. Now, ctrl+drag another set (5, 6), the selection lost is (4). So we can say that the selection lost is the last one done. This is only a workaround and should be removed when fixed on Qt (I am going to debug it on Qt, to see where the fail is). This workaround does not only fix KCategorizedView, but QListView also. CCMAIL: [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=748545
Diffstat (limited to 'src')
-rw-r--r--src/kcategorizedview.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp
index 6590c4b2a..152573214 100644
--- a/src/kcategorizedview.cpp
+++ b/src/kcategorizedview.cpp
@@ -39,6 +39,11 @@
// Qt 4.4, so that this workaround can be skipped.
#define DOLPHIN_DRAGANDDROP
+// By defining KDE_WORKAROUND_FOR_QT_VIEW_BUG we save the selection being held
+// before mousePressEvent happens. On Qt there is something clearing the last
+// selection made, what make it impossible to save our very last selection.
+#define KDE_WORKAROUND_FOR_QT_VIEW_BUG
+
KCategorizedView::Private::Private(KCategorizedView *listView)
: listView(listView)
, categoryDrawer(0)
@@ -1038,7 +1043,13 @@ void KCategorizedView::mousePressEvent(QMouseEvent *event)
horizontalOffset());
}
+#ifdef KDE_WORKAROUND_FOR_QT_VIEW_BUG
+ QItemSelection prevSelection = selectionModel()->selection();
+#endif
QListView::mousePressEvent(event);
+#ifdef KDE_WORKAROUND_FOR_QT_VIEW_BUG
+ selectionModel()->select(prevSelection, QItemSelectionModel::Select);
+#endif
viewport()->update(d->categoryVisualRect(d->hoveredCategory));
}