Skip to content

Commit

Permalink
City Dialog: Bug fix and updates based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
jwrober committed Oct 31, 2024
1 parent e19e7e2 commit aa9849d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
24 changes: 14 additions & 10 deletions client/citydlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1792,16 +1792,16 @@ void city_dialog::update_units()
}

// set direction of the expand/collapse arrow
if (present_units_exp == false) {
ui.present_units_exp_col_but->setArrowType(Qt::UpArrow);
} else {
if (present_units_exp) {
ui.present_units_exp_col_but->setArrowType(Qt::DownArrow);
} else {
ui.present_units_exp_col_but->setArrowType(Qt::UpArrow);
}

n = unit_list_size(units);
ui.present_units_list->setLayoutDirection(Qt::LeftToRight);
ui.present_units_list->set_units(units);
ui.present_units_list->setVisible(n > 0);
ui.present_units_list->setVisible(n >= 0);
fc_snprintf(buf, sizeof(buf), _("Present units: %d"), n);
ui.present_units_label->setText(QString(buf));
}
Expand All @@ -1811,16 +1811,20 @@ void city_dialog::update_units()
*/
void city_dialog::present_units_exp_col()
{
if (present_units_exp == false) {
ui.present_units_group_box->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Expanding);
ui.present_units_exp_col_but->setArrowType(Qt::DownArrow);
present_units_exp = true;
} else {
if (present_units_exp) {
ui.present_units_group_box->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Minimum);
ui.present_units_exp_col_but->setArrowType(Qt::UpArrow);
ui.present_units_exp_col_but->setToolTip(
_("Click to expand the present units list"));
present_units_exp = false;
} else {
ui.present_units_group_box->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Expanding);
ui.present_units_exp_col_but->setArrowType(Qt::DownArrow);
ui.present_units_exp_col_but->setToolTip(
_("Click to collapse the present units list"));
present_units_exp = true;
}
}

Expand Down
3 changes: 3 additions & 0 deletions client/citydlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="present_units_label">
Expand Down

0 comments on commit aa9849d

Please sign in to comment.