Skip to content

Commit

Permalink
Enforce equal distributution of the units and UWT widget
Browse files Browse the repository at this point in the history
The units-table is a bit smaller than the units-waiting-table because
the buttons are part of the units widget.
  • Loading branch information
blabber authored and jwrober committed Jul 28, 2024
1 parent 25e18ce commit f952681
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/views/view_units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ units_view::units_view() : QWidget()
ui.uwt_label->setText("Units Waiting:");

// Configure the splitter
/* HACK: Why do we need to set the strech factor to 2:1
* in order to achieve a split that resembles 1:1? */
ui.splitter->setStretchFactor(0, 2);
ui.splitter->setStretchFactor(1, 1);
// Configuring the splitter to distribute its children equally, is more
// complicated than one might expect. We need to set the child widgets
// sizes to the same value, using the QSplitters setSizes method. As QT
// will still enforce the minimum size policy, we have to base this value
// on the maximum minimum size of the children.
auto equalHeight = std::max(ui.units_widget->minimumSizeHint().height(),
ui.uwt_widget->minimumSizeHint().height());
ui.splitter->setSizes({equalHeight, equalHeight});

// Add shield icon for shield upkeep column
const QPixmap *spr =
Expand Down

0 comments on commit f952681

Please sign in to comment.