diff --git a/src/ui/form/controls/controlutil.cpp b/src/ui/form/controls/controlutil.cpp index 72e653ab..b47de1d6 100644 --- a/src/ui/form/controls/controlutil.cpp +++ b/src/ui/form/controls/controlutil.cpp @@ -41,6 +41,7 @@ QSpinBox *ControlUtil::createSpinBox() QComboBox *ControlUtil::createComboBox(const QStringList &texts) { auto c = new ComboBox(); + c->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); c->addItems(texts); return c; } diff --git a/src/ui/form/stat/pages/trafficpage.cpp b/src/ui/form/stat/pages/trafficpage.cpp index 7cdd46f0..8992ee08 100644 --- a/src/ui/form/stat/pages/trafficpage.cpp +++ b/src/ui/form/stat/pages/trafficpage.cpp @@ -133,20 +133,15 @@ void TrafficPage::setupUi() QLayout *TrafficPage::setupHeader() { - auto layout = new QHBoxLayout(); - m_btRefresh = ControlUtil::createFlatToolButton( ":/icons/arrow_refresh_small.png", [&] { trafListModel()->reset(); }); setupClearMenu(); setupTrafUnits(); - layout->addWidget(m_btRefresh); - layout->addWidget(m_btClear); - layout->addWidget(ControlUtil::createVSeparator()); - layout->addWidget(m_traphUnits); - layout->addWidget(m_comboTrafUnit); - layout->addStretch(); + auto layout = ControlUtil::createHLayoutByWidgets({ m_btRefresh, m_btClear, + ControlUtil::createVSeparator(), m_traphUnits, m_comboTrafUnit, + /*stretch*/ nullptr }); return layout; } @@ -196,6 +191,7 @@ void TrafficPage::setupTrafUnits() confManager()->saveIniUser(); }); + m_comboTrafUnit->setMinimumWidth(100); } void TrafficPage::setupAppListView()