]> cloud.milkyroute.net Git - dolphin.git/commitdiff
It is possible that the selection of an inactive column gets changed (e. g. by the...
authorPeter Penz <peter.penz19@gmail.com>
Wed, 6 Jan 2010 18:40:55 +0000 (18:40 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 6 Jan 2010 18:40:55 +0000 (18:40 +0000)
BUG: 188979

svn path=/trunk/KDE/kdebase/apps/; revision=1070789

src/dolphincolumnview.cpp
src/dolphincolumnview.h

index ac131497e5a20608aa232c0d50a82c8f90f210c3..361ddf6962561da4474b368b8786c9e264637c98 100644 (file)
@@ -192,6 +192,22 @@ KFileItem DolphinColumnView::itemAt(const QPoint& pos) const
     return item;
 }
 
+void DolphinColumnView::setSelectionModel(QItemSelectionModel* model)
+{
+    // If a change of the selection is done although the view is not active
+    // (e. g. by the selection markers), the column must be activated. This
+    // is done by listening to the current selectionChanged() signal.
+    if (selectionModel() != 0) {
+        disconnect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+                   this, SLOT(requestActivation()));
+    }
+
+    QListView::setSelectionModel(model);
+
+    connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+            this, SLOT(requestActivation()));
+}
+
 QStyleOptionViewItem DolphinColumnView::viewOptions() const
 {
     QStyleOptionViewItem viewOptions = QListView::viewOptions();
index c73ffc094516d027de54371bcbc1c3df809a7cc5..d4da8665711442dc93d61669070aa0b347e2ffe9 100644 (file)
@@ -85,6 +85,8 @@ public:
      */
     KFileItem itemAt(const QPoint& pos) const;
 
+    virtual void setSelectionModel(QItemSelectionModel* model);
+
 protected:
     virtual QStyleOptionViewItem viewOptions() const;
     virtual void startDrag(Qt::DropActions supportedActions);