[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bdigikam/development/2=2E0=5D_libs/widgets/common=3A?=
From: Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date: 2011-03-02 20:44:47
Message-ID: 20110302204447.C496FA60D3 () git ! kde ! org
[Download RAW message or body]
Git commit 9cc69e088c31abfb9fb7363c3e9ab7f2544426c6 by Marcel Wiesweg.
Committed on 02/03/2011 at 21:02.
Pushed by mwiesweg into branch 'development/2.0'.
Improve drawing of the group indicator. It is still awkward because we have noone
to make us custom icons, so I have to use what I find.
May not work with other icon sets. No better solution from me atm, I dont want to
do custom drawing in C++.
M +19 -7 libs/widgets/common/itemviewimagedelegate.cpp
M +1 -1 libs/widgets/common/itemviewimagedelegate.h
http://commits.kde.org/digikam/9cc69e088c31abfb9fb7363c3e9ab7f2544426c6
diff --git a/libs/widgets/common/itemviewimagedelegate.cpp \
b/libs/widgets/common/itemviewimagedelegate.cpp index e5eeed4..e1e296c 100644
--- a/libs/widgets/common/itemviewimagedelegate.cpp
+++ b/libs/widgets/common/itemviewimagedelegate.cpp
@@ -417,22 +417,34 @@ void ItemViewImageDelegate::drawPickLabelIcon(QPainter* p, \
const QRect& r, int p }
}
-void ItemViewImageDelegate::drawGroupIndicator(QPainter* p, const QRect& r, int \
numberOfGroupedImages) const +void \
ItemViewImageDelegate::drawGroupIndicator(QPainter* p, const QRect& r, + \
int numberOfGroupedImages, bool open) const {
if (numberOfGroupedImages)
{
- QIcon icon = KIconLoader::global()->loadIcon("mail-attachment", \
KIconLoader::NoGroup, r.width()); + QIcon icon;
+ if (open)
+ {
+ icon = KIconLoader::global()->loadIcon("document-import", \
KIconLoader::NoGroup, r.width()); + }
+ else
+ {
+ icon = KIconLoader::global()->loadIcon("document-multiple", \
KIconLoader::NoGroup, r.width()); + }
+ qreal op = p->opacity();
p->setOpacity(0.5);
icon.paint(p, r);
- p->setOpacity(1.0);
+ p->setOpacity(op);
QString text = QString::number(numberOfGroupedImages);
- /*QRect br = p.boundingRect(pixmapRect, Qt::AlignLeft|Qt::AlignTop, \
text1).adjusted(0,0,1,1); + /*
+ QRect br = p->boundingRect(r, Qt::AlignLeft|Qt::AlignTop, \
text).adjusted(0,0,1,1); int rectSize = qMax(br.width(), br.height());
- textRect = QRect(0, 0, rectSize, rectSize);
- textRect.moveLeft((r.width() - textRect.width()) / 2 + r.x());
+ QRect textRect = QRect(0, 0, rectSize, rectSize);
+ textRect.moveLeft((r.width() - textRect.width()) / 2);
textRect.moveTop((r.height() - textRect.height()) * 4 / 5);
- p.fillRect(textRect, QColor(0, 0, 0, 128));*/
+ p->fillRect(textRect.translated(r.topLeft(), QColor(0, 0, 0, 128));
+ */
p->drawText(r, Qt::AlignCenter, text);
}
}
diff --git a/libs/widgets/common/itemviewimagedelegate.h \
b/libs/widgets/common/itemviewimagedelegate.h index 0b5ca1d..7bffc67 100644
--- a/libs/widgets/common/itemviewimagedelegate.h
+++ b/libs/widgets/common/itemviewimagedelegate.h
@@ -113,7 +113,7 @@ protected:
void drawTags(QPainter* p, const QRect& r, const QString& tagsString, bool \
isSelected) const;
void drawColorLabelRect(QPainter* p, const QStyleOptionViewItem& option, bool \
isSelected, int colorId) const;
void drawPickLabelIcon(QPainter* p, const QRect& r, int pickLabel) const;
- void drawGroupIndicator(QPainter* p, const QRect& r, int numberOfGroupedImages) \
const; + void drawGroupIndicator(QPainter* p, const QRect& r, int \
numberOfGroupedImages, bool open) const;
void drawFocusRect(QPainter* p, const QStyleOptionViewItem& option, bool \
isSelected) const;
void drawMouseOverRect(QPainter* p, const QStyleOptionViewItem& option) const;
void prepareFonts();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic