┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphindetailsview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-06-02 17:28:59 +0000
committerPeter Penz <[email protected]>2007-06-02 17:28:59 +0000
commite78615f172a2b9f549da6eef2b343a472d42f45f (patch)
tree5fe9ce5bec06055b849f0452f6db6265ef91d3f1 /src/dolphindetailsview.cpp
parentf7a5c62746b91a1e96387c697605544e7df2ffb2 (diff)
Provide a hover information when dragging items above other items. TODO: this code can be removed again when issue #160611 is solved in Qt 4.4.
svn path=/trunk/KDE/kdebase/apps/; revision=670848
Diffstat (limited to 'src/dolphindetailsview.cpp')
-rw-r--r--src/dolphindetailsview.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 961fb15a3..28901bea7 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -39,6 +39,7 @@
DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) :
QTreeView(parent),
m_controller(controller),
+ m_dragging(false),
m_showElasticBand(false),
m_elasticBandOrigin(),
m_elasticBandDestination()
@@ -203,6 +204,19 @@ void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event)
updateElasticBand();
m_showElasticBand = false;
}
+ m_dragging = true;
+}
+
+void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event)
+{
+ QTreeView::dragMoveEvent(event);
+
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
+ const QPoint pos(0, event->pos().y());
+ const QModelIndex index = indexAt(pos);
+ setDirtyRegion(m_dropRect);
+ m_dropRect = visualRect(index);
+ setDirtyRegion(m_dropRect);
}
void DolphinDetailsView::dropEvent(QDropEvent* event)
@@ -215,6 +229,7 @@ void DolphinDetailsView::dropEvent(QDropEvent* event)
event->source());
}
QTreeView::dropEvent(event);
+ m_dragging = false;
}
void DolphinDetailsView::paintEvent(QPaintEvent* event)
@@ -235,6 +250,18 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
style()->drawControl(QStyle::CE_RubberBand, &opt, &painter);
painter.restore();
}
+
+ if (m_dragging) {
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
+ QPainter painter(viewport());
+ painter.save();
+ QBrush brush(m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight));
+ QColor color = brush.color();
+ color.setAlpha(64);
+ brush.setColor(color);
+ painter.fillRect(m_dropRect, brush);
+ painter.restore();
+ }
}
void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting)