#include "dolphin_iconsmodesettings.h"
-#include <kdirmodel.h>
-#include <kfileitem.h>
-#include <kfileitemdelegate.h>
-
#include <QAbstractProxyModel>
#include <QApplication>
#include <QPainter>
Q_ASSERT(controller != 0);
setViewMode(QListView::IconMode);
setResizeMode(QListView::Adjust);
-
+ setSpacing(10);
setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
void DolphinIconsView::mousePressEvent(QMouseEvent* event)
{
+ m_controller->triggerActivation();
if (!indexAt(event->pos()).isValid()) {
const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
if (!(modifier & Qt::ShiftModifier) && !(modifier & Qt::ControlModifier)) {
KListView::mousePressEvent(event);
}
-void DolphinIconsView::mouseReleaseEvent(QMouseEvent* event)
-{
- KListView::mouseReleaseEvent(event);
- m_controller->triggerActivation();
-}
-
void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
{
if (event->mimeData()->hasUrls()) {
m_dragging = true;
}
+void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event)
+{
+ KListView::dragLeaveEvent(event);
+
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
+ m_dragging = false;
+ setDirtyRegion(m_dropRect);
+}
+
void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event)
{
KListView::dragMoveEvent(event);
{
KListView::paintEvent(event);
+ // TODO: remove this code when the issue #160611 is solved in Qt 4.4
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();
+ const QBrush& brush = m_viewOptions.palette.brush(QPalette::Normal, QPalette::Highlight);
+ DolphinController::drawHoverIndication(viewport(), m_dropRect, brush);
}
}