diff options
Diffstat (limited to 'Swift/QtUI/Roster/RosterDelegate.cpp')
-rw-r--r-- | Swift/QtUI/Roster/RosterDelegate.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Swift/QtUI/Roster/RosterDelegate.cpp b/Swift/QtUI/Roster/RosterDelegate.cpp index e40907a..7e6428b 100644 --- a/Swift/QtUI/Roster/RosterDelegate.cpp +++ b/Swift/QtUI/Roster/RosterDelegate.cpp @@ -24,7 +24,7 @@ namespace Swift { -RosterDelegate::RosterDelegate(QtTreeWidget* tree) { +RosterDelegate::RosterDelegate(QtTreeWidget* tree, bool compact) : compact_(compact) { tree_ = tree; groupDelegate_ = new GroupItemDelegate(); } @@ -32,6 +32,10 @@ RosterDelegate::RosterDelegate(QtTreeWidget* tree) { RosterDelegate::~RosterDelegate() { delete groupDelegate_; } + +void RosterDelegate::setCompact(bool compact) { + compact_ = compact; +} QSize RosterDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const { RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); @@ -42,7 +46,7 @@ QSize RosterDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelI } QSize RosterDelegate::contactSizeHint(const QStyleOptionViewItem& option, const QModelIndex& index ) const { - return common_.contactSizeHint(option, index); + return common_.contactSizeHint(option, index, compact_); } void RosterDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { @@ -71,7 +75,7 @@ void RosterDelegate::paintContact(QPainter* painter, const QStyleOptionViewItem& : QIcon(":/icons/offline.png"); QString name = index.data(Qt::DisplayRole).toString(); QString statusText = index.data(StatusTextRole).toString(); - common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, 0); + common_.paintContact(painter, option, nameColor, avatarPath, presenceIcon, name, statusText, 0, compact_); } } |