diff options
| author | Kevin Smith <git@kismith.co.uk> | 2009-11-23 19:53:43 (GMT) |
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2009-11-23 19:53:43 (GMT) |
| commit | 3c1a47964d8434262d2ad9285345fb884f2a839b (patch) | |
| tree | 64230efde601e6b9a90b6f2a4651a1a96d41a2fb /Swift/QtUI | |
| parent | b8aa124f6baa0c0a32ccfd7479fa1e6f0dff3487 (diff) | |
| download | swift-3c1a47964d8434262d2ad9285345fb884f2a839b.zip swift-3c1a47964d8434262d2ad9285345fb884f2a839b.tar.bz2 | |
Don't cut off the roster in its prime
Diffstat (limited to 'Swift/QtUI')
| -rw-r--r-- | Swift/QtUI/Roster/RosterDelegate.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp index 661c02d..77b0401 100644 --- a/Swift/QtUI/Roster/RosterDelegate.cpp +++ b/Swift/QtUI/Roster/RosterDelegate.cpp @@ -134,74 +134,74 @@ void RosterDelegate::paintExpansionTriangle(QPainter* painter, const QRect& regi trianglePath.addPolygon(triangle); triangleShadowPath.addPolygon(triangleShadow); painter->fillPath(triangleShadowPath, triangleShadowBrush); painter->fillPath(trianglePath, triangleBrush); } void RosterDelegate::paintShadowText(QPainter* painter, const QRect& region, const QString& text) const { painter->setPen(QPen(QColor(254, 254, 254))); painter->drawText(region.adjusted(0, 1, 0, 0), Qt::AlignTop, text); painter->setPen(QPen(QColor(115, 115, 115))); painter->drawText(region, Qt::AlignTop, text); } void RosterDelegate::paintContact(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { //qDebug() << "painting" << index.data(Qt::DisplayRole).toString(); painter->save(); //QStyledItemDelegate::paint(painter, option, index); //initStyleOption(option, index); QRect fullRegion(option.rect); if ( option.state & QStyle::State_Selected ) { painter->fillRect(fullRegion, option.palette.highlight()); painter->setPen(option.palette.highlightedText().color()); } else { QColor nameColor = index.data(Qt::TextColorRole).value<QColor>(); painter->setPen(QPen(nameColor)); } QRect presenceIconRegion(QPoint(farLeftMargin_, fullRegion.top()), QSize(presenceIconWidth_, fullRegion.height() - verticalMargin_)); int calculatedAvatarSize = presenceIconRegion.height(); //This overlaps the presenceIcon, so must be painted first QRect avatarRegion(QPoint(presenceIconRegion.right() - presenceIconWidth_ / 2, presenceIconRegion.top()), QSize(calculatedAvatarSize, calculatedAvatarSize)); QIcon avatar = index.data(AvatarRole).isValid() && !index.data(AvatarRole).value<QIcon>().isNull() ? index.data(AvatarRole).value<QIcon>() : QIcon(":/icons/avatar.png"); avatar.paint(painter, avatarRegion, Qt::AlignVCenter | Qt::AlignHCenter); //Paint the presence icon over the top of the avatar QIcon presenceIcon = index.data(PresenceIconRole).isValid() && !index.data(PresenceIconRole).value<QIcon>().isNull() ? index.data(PresenceIconRole).value<QIcon>() : QIcon(":/icons/offline.png"); presenceIcon.paint(painter, presenceIconRegion, Qt::AlignBottom | Qt::AlignHCenter); QFontMetrics nameMetrics(nameFont_); painter->setFont(nameFont_); int extraFontWidth = nameMetrics.width("H"); int leftOffset = avatarRegion.right() + horizontalMargin_ * 2 + extraFontWidth / 2; - QRect textRegion(fullRegion.adjusted(leftOffset, 0, -leftOffset, 0)); + QRect textRegion(fullRegion.adjusted(leftOffset, 0, 0/*-leftOffset*/, 0)); int nameHeight = nameMetrics.height() + verticalMargin_; QRect nameRegion(textRegion.adjusted(0, verticalMargin_, 0, 0)); painter->drawText(nameRegion, Qt::AlignTop, index.data(Qt::DisplayRole).toString()); painter->setFont(statusFont_); painter->setPen(QPen(QColor(160,160,160))); QRect statusTextRegion(textRegion.adjusted(0, nameHeight, 0, 0)); painter->drawText(statusTextRegion, Qt::AlignTop, index.data(StatusTextRole).toString()); painter->restore(); } const int RosterDelegate::avatarSize_ = 20; const int RosterDelegate::presenceIconHeight_ = 16; const int RosterDelegate::presenceIconWidth_ = 16; const int RosterDelegate::groupCornerRadius_ = 0; const int RosterDelegate::horizontalMargin_ = 2; const int RosterDelegate::verticalMargin_ = 2; const int RosterDelegate::farLeftMargin_ = 2; } |
Swift