]> cloud.milkyroute.net Git - dolphin.git/commitdiff
The drag&drop helper did not make the difference between the different kind of views...
authorRafael Fernández López <ereslibre@kde.org>
Sun, 16 Dec 2007 20:56:24 +0000 (20:56 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Sun, 16 Dec 2007 20:56:24 +0000 (20:56 +0000)
mode. For that reason, the drop marker with the detailed view was drawn with rounded corners. For making it consistent, we draw the drop indicator as the hover effect
indicator, so the only one that draws rounded corners is the icon one.

CCMAIL: peter.penz@gmx.at

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

src/dolphincolumnwidget.cpp
src/dolphindetailsview.cpp
src/dolphiniconsview.cpp
src/draganddrophelper.cpp
src/draganddrophelper.h
src/sidebartreeview.cpp

index 7d29251ea62057abdaa79ef15521ea76cedc7420..9a500df6b379f234e198256c97aebaf4a24e1cc1 100644 (file)
@@ -290,7 +290,7 @@ void DolphinColumnWidget::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }
 
index 36ea99ad82fdbb96d2de413cb7dbc2e4df42b1c7..46752fc95a39870bac6a84256d8cded1678ee1dc 100644 (file)
@@ -320,7 +320,7 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }
 
index 0c888d8714ca9f566828d8414eabb596cba294aa..8d474f4bc5f15fe2b44b6ba94f6e4447c1170ef6 100644 (file)
@@ -268,7 +268,7 @@ void DolphinIconsView::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }
 
index 39af6a3ce559a3add600c2d7683817081f0f4c42..0148f731b86e95875d79dec320af2ca622923b46 100644 (file)
@@ -18,6 +18,7 @@
  ***************************************************************************/
 
 #include "draganddrophelper.h"
+#include "dolphiniconsview.h"
 
 #include <kdirmodel.h>
 #include <kicon.h>
@@ -57,7 +58,7 @@ void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions s
     }
 }
 
-void DragAndDropHelper::drawHoverIndication(QWidget* widget,
+void DragAndDropHelper::drawHoverIndication(QAbstractItemView* itemView,
                                             const QRect& bounds,
                                             const QBrush& brush)
 {
@@ -65,6 +66,8 @@ void DragAndDropHelper::drawHoverIndication(QWidget* widget,
         return;
     }
 
+    QWidget* widget = itemView->viewport();
+
     QPainter painter(widget);
     painter.save();
     QBrush blendedBrush(brush);
@@ -72,18 +75,22 @@ void DragAndDropHelper::drawHoverIndication(QWidget* widget,
     color.setAlpha(64);
     blendedBrush.setColor(color);
 
-    const int radius = 10;
-    QPainterPath path(QPointF(bounds.left(), bounds.top() + radius));
-    path.quadTo(bounds.left(), bounds.top(), bounds.left() + radius, bounds.top());
-    path.lineTo(bounds.right() - radius, bounds.top());
-    path.quadTo(bounds.right(), bounds.top(), bounds.right(), bounds.top() + radius);
-    path.lineTo(bounds.right(), bounds.bottom() - radius);
-    path.quadTo(bounds.right(), bounds.bottom(), bounds.right() - radius, bounds.bottom());
-    path.lineTo(bounds.left() + radius, bounds.bottom());
-    path.quadTo(bounds.left(), bounds.bottom(), bounds.left(), bounds.bottom() - radius);
-    path.closeSubpath();
+    if (dynamic_cast<DolphinIconsView*>(itemView)) {
+        const int radius = 10;
+        QPainterPath path(QPointF(bounds.left(), bounds.top() + radius));
+        path.quadTo(bounds.left(), bounds.top(), bounds.left() + radius, bounds.top());
+        path.lineTo(bounds.right() - radius, bounds.top());
+        path.quadTo(bounds.right(), bounds.top(), bounds.right(), bounds.top() + radius);
+        path.lineTo(bounds.right(), bounds.bottom() - radius);
+        path.quadTo(bounds.right(), bounds.bottom(), bounds.right() - radius, bounds.bottom());
+        path.lineTo(bounds.left() + radius, bounds.bottom());
+        path.quadTo(bounds.left(), bounds.bottom(), bounds.left(), bounds.bottom() - radius);
+        path.closeSubpath();
 
-    painter.setRenderHint(QPainter::Antialiasing);
-    painter.fillPath(path, blendedBrush);
+        painter.setRenderHint(QPainter::Antialiasing);
+        painter.fillPath(path, blendedBrush);
+    } else {
+        painter.fillRect(bounds, blendedBrush);
+    }
     painter.restore();
 }
index 8003b75d2b4733aea8a153849bb3313cbe94e035..8e1e4531f467870d159f09c721f16e51e4f74d77 100644 (file)
@@ -44,7 +44,7 @@ public:
     static void startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions);
 
     // TODO: remove this method when the issue #160611 is solved in Qt 4.4
-    static void drawHoverIndication(QWidget* widget,
+    static void drawHoverIndication(QAbstractItemView* itemView,
                                     const QRect& bounds,
                                     const QBrush& brush);
 };
index 9ab10a0b26851f0aab0238650d7b1456b91b8e80..af676541a6b60a46c7cfbe7828b0dc6211a4b1f7 100644 (file)
@@ -155,7 +155,7 @@ void SidebarTreeView::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = palette().brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }