------------------------------------------------------------
revno: 102
committer: Aurelien Gateau <[email protected]>
branch nick: plasma-indicatordisplay
timestamp: Thu 2009-10-08 16:16:12 +0200
message:
Smarter computation of item width
modified:
src/delegate.cpp
--
lp:plasma-indicatordisplay
https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk
Your team ayatana-commits is subscribed to branch lp:plasma-indicatordisplay.
To unsubscribe from this branch go to
https://code.launchpad.net/~agateau/plasma-indicatordisplay/trunk/+edit-subscription.
=== modified file 'src/delegate.cpp'
--- src/delegate.cpp 2009-09-17 13:48:34 +0000
+++ src/delegate.cpp 2009-10-08 14:16:12 +0000
@@ -154,9 +154,17 @@
QSize sh = QStyledItemDelegate::sizeHint(option, index);
sh.rheight() += VSPACING * 2;
- // Should this be a bit smarter than hardcoding an extra padding to the
- // right?
- sh.rwidth() += QFontMetrics(option.font).width(" 00000 ");
+ QString extraText;
+ int count = index.data(ListenerModel::CountRole).toInt();
+ if (count > 0) {
+ extraText = " " + QString::number(count);
+ } else {
+ extraText = " " + timeTextForIndex(index);
+ }
+
+ if (!extraText.isEmpty()) {
+ sh.rwidth() += QFontMetrics(option.font).width(extraText);
+ }
if (!index.parent().isValid() && index.row() != 0) {
// A server item, but not the first one. Keep room for the separator
_______________________________________________
Mailing list: https://launchpad.net/~ayatana-commits
Post to : [email protected]
Unsubscribe : https://launchpad.net/~ayatana-commits
More help : https://help.launchpad.net/ListHelp