From 51bfaa4c831bf018cad832dfd1b05c6b9418cf78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Wed, 12 May 2010 15:18:32 +0200
Subject: [PATCH] Fixed handling of selection dragging in resource editor

When dragging the mouse to select an item that is not currently visible,
the ResourceView was not making the selected item visible. This was due
to an unnecessary reimplementation the protected currentChanged slot.

Reviewed-by: owolff
---
 src/shared/qrceditor/qrceditor.cpp    | 3 ++-
 src/shared/qrceditor/resourceview.cpp | 7 -------
 src/shared/qrceditor/resourceview.h   | 4 ----
 3 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/shared/qrceditor/qrceditor.cpp b/src/shared/qrceditor/qrceditor.cpp
index ecb0efde45b..693faf54c61 100644
--- a/src/shared/qrceditor/qrceditor.cpp
+++ b/src/shared/qrceditor/qrceditor.cpp
@@ -61,7 +61,8 @@ QrcEditor::QrcEditor(QWidget *parent)
     connect(m_treeview, SIGNAL(addPrefixTriggered()), this, SLOT(onAddPrefix()));
     connect(m_treeview, SIGNAL(addFilesTriggered(QString)), this, SLOT(onAddFiles()));
     connect(m_treeview, SIGNAL(removeItem()), this, SLOT(onRemove()));
-    connect(m_treeview, SIGNAL(currentIndexChanged()), this, SLOT(updateCurrent()));
+    connect(m_treeview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
+            this, SLOT(updateCurrent()));
     connect(m_treeview, SIGNAL(dirtyChanged(bool)), this, SIGNAL(dirtyChanged(bool)));
     m_treeview->setFocus();
 
diff --git a/src/shared/qrceditor/resourceview.cpp b/src/shared/qrceditor/resourceview.cpp
index d0b077cc92c..814d044c9bc 100644
--- a/src/shared/qrceditor/resourceview.cpp
+++ b/src/shared/qrceditor/resourceview.cpp
@@ -203,13 +203,6 @@ ResourceView::~ResourceView()
 {
 }
 
-void ResourceView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
-{
-    Q_UNUSED(current)
-    Q_UNUSED(previous)
-    emit currentIndexChanged();
-}
-
 bool ResourceView::isDirty() const
 {
     return m_qrcModel->dirty();
diff --git a/src/shared/qrceditor/resourceview.h b/src/shared/qrceditor/resourceview.h
index a0da7df5977..2e44da25a7f 100644
--- a/src/shared/qrceditor/resourceview.h
+++ b/src/shared/qrceditor/resourceview.h
@@ -139,14 +139,10 @@ protected:
 signals:
     void removeItem();
     void dirtyChanged(bool b);
-    void currentIndexChanged();
 
     void addFilesTriggered(const QString &prefix);
     void addPrefixTriggered();
 
-protected slots:
-    void currentChanged(const QModelIndex &current, const QModelIndex &previous);
-
 private slots:
     void onEditAlias();
     void onEditPrefix();
-- 
GitLab