summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster/RosterDelegate.cpp')
-rw-r--r--Swift/QtUI/Roster/RosterDelegate.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp
index 3b3d6fe..2447e8f 100644
--- a/Swift/QtUI/Roster/RosterDelegate.cpp
+++ b/Swift/QtUI/Roster/RosterDelegate.cpp
@@ -15,7 +15,7 @@ QSize RosterDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelI
return QStyledItemDelegate::sizeHint(option, index);
}
//Doesn't work, yay! FIXME: why?
- QSize size = (option.state & QStyle::State_Selected) ? QSize(150, 80) : QSize(150,56);
+ QSize size = (option.state & QStyle::State_Selected) ? QSize(150, 80) : QSize(150, avatarSize_ + margin_ * 2);
qDebug() << "Returning size" << size;
return size;
}
@@ -35,7 +35,7 @@ void RosterDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
painter->fillRect(fullRegion, option.palette.highlight());
painter->setPen(option.palette.highlightedText().color());
}
- QRect avatarRegion(QPoint(4, fullRegion.top() + 4), QSize(48, 48));
+ QRect avatarRegion(QPoint(margin_, fullRegion.top() + margin_), QSize(avatarSize_, avatarSize_));
QIcon icon = index.data(AvatarRole).isValid() && !index.data(AvatarRole).value<QIcon>().isNull()
? index.data(AvatarRole).value<QIcon>()
: QIcon(":/icons/avatar.png");
@@ -45,11 +45,11 @@ void RosterDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
QFont statusFont = painter->font();
painter->setFont(nameFont);
- QRect textRegion(fullRegion.adjusted(56, 0, 0, 0));
+ QRect textRegion(fullRegion.adjusted(avatarSize_ + margin_ * 2, 0, 0, 0));
QFontMetrics nameMetrics(nameFont);
- int nameHeight = nameMetrics.height() + 8;
- QRect nameRegion(textRegion.adjusted(0, 4, 0, -1 * nameHeight));
+ int nameHeight = nameMetrics.height() + margin_ * 2;
+ QRect nameRegion(textRegion.adjusted(0, margin_, 0, 0));
painter->drawText(nameRegion, Qt::AlignTop, index.data(Qt::DisplayRole).toString());
statusFont.setStyle(QFont::StyleItalic);