┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-05-11 19:34:34 +0000
committerPeter Penz <[email protected]>2008-05-11 19:34:34 +0000
commit2ad91b45342ddd49854ae2b31a9c6cada1ad1c4e (patch)
tree49e3ca675910fd89ce96ad089111a9ab6c2570d8 /src
parent75c91317fe33cb81342cabcfe0fa64c947fdd8e8 (diff)
Per default QTreeView starts either a selection or a drag operation when dragging the expanding toggle button (tricky and hard to reproducible Qt-issue - see TODO comment in DolphinIconsView::mousePressEvent()). Turn off this behavior in Dolphin to stay predictable.
svn path=/trunk/KDE/kdebase/apps/; revision=806597
Diffstat (limited to 'src')
-rw-r--r--src/dolphindetailsview.cpp15
-rw-r--r--src/dolphindetailsview.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index e33d94c18..e3a69fea4 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -46,6 +46,7 @@
DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) :
QTreeView(parent),
m_autoResize(true),
+ m_expandingTogglePressed(false),
m_controller(controller),
m_selectionManager(0),
m_font(),
@@ -187,6 +188,7 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
QTreeView::mousePressEvent(event);
+ m_expandingTogglePressed = false;
const QModelIndex index = indexAt(event->pos());
const bool updateState = index.isValid() &&
(index.column() == DolphinModel::Name) &&
@@ -197,6 +199,8 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
const QRect rect = visualRect(index);
if (event->pos().x() >= rect.x() + indentation()) {
setState(QAbstractItemView::DraggingState);
+ } else {
+ m_expandingTogglePressed = true;
}
}
@@ -207,7 +211,7 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
}
}
- if (event->button() == Qt::LeftButton) {
+ if ((event->button() == Qt::LeftButton) && !m_expandingTogglePressed) {
m_showElasticBand = true;
const QPoint pos(contentsPos());
@@ -248,11 +252,20 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event)
// QTreeView::mouseMoveEvent(event);
QAbstractItemView::mouseMoveEvent(event);
}
+
+ if (m_expandingTogglePressed) {
+ // Per default QTreeView starts either a selection or a drag operation when dragging
+ // the expanding toggle button (Qt-issue - see TODO comment in DolphinIconsView::mousePressEvent()).
+ // Turn off this behavior in Dolphin to stay predictable:
+ clearSelection();
+ setState(QAbstractItemView::NoState);
+ }
}
void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event)
{
QTreeView::mouseReleaseEvent(event);
+ m_expandingTogglePressed = false;
if (m_showElasticBand) {
updateElasticBand();
m_showElasticBand = false;
diff --git a/src/dolphindetailsview.h b/src/dolphindetailsview.h
index 829e53967..0acafddfc 100644
--- a/src/dolphindetailsview.h
+++ b/src/dolphindetailsview.h
@@ -157,6 +157,7 @@ private:
private:
bool m_autoResize; // if true, the columns are resized automatically to the available width
+ bool m_expandingTogglePressed;
DolphinController* m_controller;
SelectionManager* m_selectionManager;