fix wonky avatar layout on MacOS

surely the maximum size for the text should be the width of the parent
(i.e. topLayout) minus the width of the avatar layout, which is max_height_?
This commit is contained in:
Matthew Hodgson 2017-04-30 01:20:36 +01:00
parent 57332553c4
commit 7ca2b188a8

View File

@ -77,12 +77,12 @@ RoomInfoListItem::RoomInfoListItem(RoomInfo info, QWidget *parent)
avatarLayout_->addWidget(roomAvatar_);
roomName_ = new QLabel(info_.name(), textWidget_);
roomName_->setMaximumSize(parent->width() - 10, 20);
roomName_->setMaximumSize(parent->width() - max_height_, 20);
roomName_->setStyleSheet("font-weight: 400; font-size: 14px;");
roomName_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
roomTopic_ = new QLabel(info_.topic(), textWidget_);
roomTopic_->setMaximumSize(parent->width() - 10, 20);
roomTopic_->setMaximumSize(parent->width() - max_height_, 20);
roomTopic_->setStyleSheet("color: #171919; font-size: 12px");
roomTopic_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@ -92,8 +92,8 @@ RoomInfoListItem::RoomInfoListItem(RoomInfo info, QWidget *parent)
topLayout_->addWidget(avatarWidget_);
topLayout_->addWidget(textWidget_);
setElidedText(roomName_, info_.name(), parent->width() - 10);
setElidedText(roomTopic_, info_.topic(), parent->width() - 10);
setElidedText(roomName_, info_.name(), parent->width() - max_height_);
setElidedText(roomTopic_, info_.topic(), parent->width() - max_height_);
QPainterPath path;
path.addRoundedRect(rect(), 0, 0);