summary refs log tree commit diff
path: root/src/TopRoomBar.cpp
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-10-04 00:32:13 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-10-04 00:32:13 +0300
commit420937ab8337f181105a571cdcb33d4d05091ed5 (patch)
treebb55527c22ed5de0fbcd3f2f2f5049f5f7740702 /src/TopRoomBar.cpp
parentRemove some unnecessary calls (diff)
downloadnheko-420937ab8337f181105a571cdcb33d4d05091ed5.tar.xz
Derive widget sizing from the font size
Diffstat (limited to 'src/TopRoomBar.cpp')
-rw-r--r--src/TopRoomBar.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/TopRoomBar.cpp b/src/TopRoomBar.cpp

index f2afb9a1..5c817dc2 100644 --- a/src/TopRoomBar.cpp +++ b/src/TopRoomBar.cpp
@@ -32,22 +32,30 @@ TopRoomBar::TopRoomBar(QWidget *parent) : QWidget(parent) , buttonSize_{32} { - setFixedHeight(56); + QFont f; + f.setPointSizeF(f.pointSizeF()); + + const int fontHeight = QFontMetrics(f).height(); + const int widgetMargin = fontHeight / 3; + const int contentHeight = fontHeight * 3; + + setFixedHeight(contentHeight + widgetMargin); topLayout_ = new QHBoxLayout(this); - topLayout_->setSpacing(8); - topLayout_->setMargin(8); + topLayout_->setSpacing(widgetMargin); + topLayout_->setContentsMargins( + 2 * widgetMargin, widgetMargin, 2 * widgetMargin, widgetMargin); avatar_ = new Avatar(this); avatar_->setLetter(""); - avatar_->setSize(35); + avatar_->setSize(fontHeight * 2); textLayout_ = new QVBoxLayout(); textLayout_->setSpacing(0); - textLayout_->setContentsMargins(0, 0, 0, 0); + textLayout_->setMargin(0); QFont roomFont; - roomFont.setPointSizeF(roomFont.pointSizeF() * 1.2); + roomFont.setPointSizeF(roomFont.pointSizeF() * 1.1); roomFont.setWeight(QFont::Medium); nameLabel_ = new QLabel(this);