diff options
| author | Rafael Fernández López <[email protected]> | 2007-06-29 01:19:56 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-06-29 01:19:56 +0000 |
| commit | fc49fd7b09e620d34b2beb3b119eee70eedb25d5 (patch) | |
| tree | 47bdfbf4fa50c833332568b13b0947a1a2b76889 /src/klistview.cpp | |
| parent | 71680def7f7c9b3e59d4bc93816b87e6131d35da (diff) | |
Better drawing when big selection rect is drawn.
svn path=/trunk/KDE/kdebase/apps/; revision=681460
Diffstat (limited to 'src/klistview.cpp')
| -rw-r--r-- | src/klistview.cpp | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/src/klistview.cpp b/src/klistview.cpp index 403e984a2..526fb8dfc 100644 --- a/src/klistview.cpp +++ b/src/klistview.cpp @@ -637,19 +637,6 @@ void KListView::paintEvent(QPaintEvent *event) itemDelegate(index)->paint(&painter, option, index); } - // Redraw categories - QStyleOptionViewItem otherOption; - foreach (const QString &category, d->categories) - { - otherOption = option; - otherOption.rect = d->categoryVisualRect(category); - - if (otherOption.rect.intersects(area)) - { - d->drawNewCategory(category, otherOption, &painter); - } - } - if (d->mouseButtonPressed && !d->isDragging) { QPoint start, end, initialPressPosition; @@ -681,6 +668,19 @@ void KListView::paintEvent(QPaintEvent *event) painter.restore(); } + // Redraw categories + QStyleOptionViewItem otherOption; + foreach (const QString &category, d->categories) + { + otherOption = option; + otherOption.rect = d->categoryVisualRect(category); + + if (otherOption.rect.intersects(area)) + { + d->drawNewCategory(category, otherOption, &painter); + } + } + if (d->isDragging && !d->dragLeftViewport) { painter.setOpacity(0.5); @@ -801,6 +801,37 @@ void KListView::mouseMoveEvent(QMouseEvent *event) viewport()->update(d->categoryVisualRect(category)); } + + QRect rect; + if (d->mouseButtonPressed && !d->isDragging) + { + QPoint start, end, initialPressPosition; + + initialPressPosition = d->initialPressPosition; + + initialPressPosition.setY(initialPressPosition.y() - verticalOffset()); + initialPressPosition.setX(initialPressPosition.x() - horizontalOffset()); + + if (d->initialPressPosition.x() > d->mousePosition.x() || + d->initialPressPosition.y() > d->mousePosition.y()) + { + start = d->mousePosition; + end = initialPressPosition; + } + else + { + start = initialPressPosition; + end = d->mousePosition; + } + + viewport()->update(d->lastSelectionRect); + + rect = QRect(start, end).intersected(viewport()->rect().adjusted(-16, -16, 16, 16)); + + viewport()->update(rect); + + d->lastSelectionRect = rect; + } } void KListView::mousePressEvent(QMouseEvent *event) |
