[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bgwenview/compare-images=5D_lib/thumbnailview=3A_Mak?=
From: Aurélien Gâteau <agateau () kde ! org>
Date: 2011-03-31 21:00:43
Message-ID: 20110331210043.F2C30A609B () git ! kde ! org
[Download RAW message or body]
Git commit 93d02871ef73ac0570394a680ad2cbd16c3799ff by Aurélien Gâteau.
Committed on 31/03/2011 at 23:00.
Pushed by gateau into branch 'compare-images'.
Make current item stand out in thumbnail bars
M +8 -8 lib/thumbnailview/thumbnailbarview.cpp
http://commits.kde.org/gwenview/93d02871ef73ac0570394a680ad2cbd16c3799ff
diff --git a/lib/thumbnailview/thumbnailbarview.cpp \
b/lib/thumbnailview/thumbnailbarview.cpp index 1cf274a..9a273e2 100644
--- a/lib/thumbnailview/thumbnailbarview.cpp
+++ b/lib/thumbnailview/thumbnailbarview.cpp
@@ -125,13 +125,21 @@ bool ThumbnailBarItemDelegate::eventFilter(QObject*, QEvent* \
event) {
void ThumbnailBarItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem \
& option, const QModelIndex & index ) const { + bool isSelected = option.state & \
QStyle::State_Selected; + bool isCurrent = d->mView->selectionModel()->currentIndex() \
== index; QPixmap thumbnailPix = d->mView->thumbnailForIndex(index);
QRect rect = option.rect;
QStyleOptionViewItemV4 opt = option;
const QWidget* widget = opt.widget;
QStyle* style = widget ? widget->style() : QApplication::style();
+ if (isSelected && !isCurrent) {
+ // Draw selected but not current item backgrounds with some transparency
+ // so that the current item stands out.
+ painter->setOpacity(.33);
+ }
style->drawControl(QStyle::CE_ItemViewItem, &opt, painter, widget);
+ painter->setOpacity(1);
// Draw thumbnail
if (!thumbnailPix.isNull()) {
@@ -158,14 +166,6 @@ void ThumbnailBarItemDelegate::paint( QPainter * painter, const \
QStyleOptionView thumbnailRect.top() + (thumbnailRect.height() - pix.height()) / 2,
pix);
}
-
- /* Enable to draw a red border around the current item
- QItemSelectionModel* selectionModel = d->mView->selectionModel();
- if (selectionModel->currentIndex() == index) {
- painter->setPen(Qt::red);
- painter->drawRect(thumbnailRect);
- }
- */
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic