Review TabLabel UI. Fix #2055

This commit is contained in:
morg 2022-01-04 00:11:08 +01:00
parent f4c4d13f6d
commit f89c56d864
2 changed files with 20 additions and 12 deletions

View file

@ -8,14 +8,6 @@ Ui::TabLabel::TabLabel(QString icon, QString name) :
ui->setupUi(this);
ui->icon->setText("<img src=':/" + icon + "' height='16' width='16' />");
ui->name->setText(name);
/*---------------------------------------------------------*\
| Make sure to properly set the tab label height depending |
| on the font in use. |
\*---------------------------------------------------------*/
QFontMetrics fontMetrics(font());
QRect rect = fontMetrics.boundingRect(0, 0, width(), height(), Qt::TextWordWrap | Qt::TextExpandTabs, name);
setFixedHeight(std::max(rect.height(), ui->icon->height()));
}
Ui::TabLabel::~TabLabel()

View file

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>200</width>
<height>25</height>
<width>222</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -20,6 +20,9 @@
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
@ -80,11 +83,23 @@
<item>
<widget class="QLabel" name="name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>device name</string>
</property>
@ -98,3 +113,4 @@
<resources/>
<connections/>
</ui>