diff --git a/client/citydlg.cpp b/client/citydlg.cpp
index acdadba01d..ec00654c94 100644
--- a/client/citydlg.cpp
+++ b/client/citydlg.cpp
@@ -904,6 +904,8 @@ city_dialog::city_dialog(QWidget *parent) : QWidget(parent)
connect(ui.p_table_p->selectionModel(),
&QItemSelectionModel::selectionChanged, this,
&city_dialog::item_selected);
+ connect(ui.present_units_exp_col_but, &QAbstractButton::clicked, this,
+ &city_dialog::present_units_exp_col);
// governor tab
ui.qgbox->setTitle(_("Presets:"));
@@ -1789,11 +1791,37 @@ void city_dialog::update_units()
units = pcity->tile->units;
}
+ // set direction of the expand/collapse arrow
+ if (present_units_exp == false) {
+ ui.present_units_exp_col_but->setArrowType(Qt::UpArrow);
+ } else {
+ ui.present_units_exp_col_but->setArrowType(Qt::DownArrow);
+ }
+
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);
fc_snprintf(buf, sizeof(buf), _("Present units: %d"), n);
- ui.curr_units->setText(QString(buf));
+ ui.present_units_label->setText(QString(buf));
+}
+
+/**
+ * Slot to expand or collapse the present units list
+ */
+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 {
+ ui.present_units_group_box->setSizePolicy(QSizePolicy::MinimumExpanding,
+ QSizePolicy::Minimum);
+ ui.present_units_exp_col_but->setArrowType(Qt::UpArrow);
+ present_units_exp = false;
+ }
}
/**
diff --git a/client/citydlg.h b/client/citydlg.h
index 7796ec3c71..d4075ca01b 100644
--- a/client/citydlg.h
+++ b/client/citydlg.h
@@ -298,6 +298,7 @@ class city_dialog : public QWidget {
void refresh();
struct city *pcity = nullptr;
bool dont_focus{false};
+ bool present_units_exp = false;
private:
void update_title();
@@ -342,6 +343,7 @@ private slots:
void cma_context_menu(const QPoint p);
void save_cma();
void city_rename();
+ void present_units_exp_col();
protected:
void showEvent(QShowEvent *event) override;
diff --git a/client/citydlg.ui b/client/citydlg.ui
index 1efbce18dd..229ecbf683 100644
--- a/client/citydlg.ui
+++ b/client/citydlg.ui
@@ -74,7 +74,7 @@
citizens
- Qt::AlignCenter
+ Qt::AlignmentFlag::AlignCenter
@@ -122,13 +122,13 @@
- QAbstractItemView::NoEditTriggers
+ QAbstractItemView::EditTrigger::NoEditTriggers
- QAbstractItemView::SingleSelection
+ QAbstractItemView::SelectionMode::SingleSelection
- QAbstractItemView::SelectRows
+ QAbstractItemView::SelectionBehavior::SelectRows
false
@@ -206,7 +206,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -268,7 +268,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -302,7 +302,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -317,10 +317,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSizePolicy::MinimumExpanding
+ QSizePolicy::Policy::MinimumExpanding
@@ -331,9 +331,9 @@
-
-
+
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -344,43 +344,59 @@
-
-
-
-
-
-
-
-
- 0
- 0
-
+
+
+
+ 0
+ 0
+
+
+
+
-
+
+
+
+ 16777215
+ 16777215
+
TextLabel
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
- -
+
-
-
+
0
0
- QAbstractItemView::ExtendedSelection
+ QAbstractItemView::SelectionMode::ExtendedSelection
- QListView::LeftToRight
+ QListView::Flow::LeftToRight
- QListView::Adjust
+ QListView::ResizeMode::Adjust
- QListView::IconMode
+ QListView::ViewMode::IconMode
+
+
+
+ -
+
+
+ ...
+
+
+
@@ -392,7 +408,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
@@ -404,15 +420,15 @@
-
-
- true
-
0
0
+
+ true
+
0
@@ -431,18 +447,18 @@
-
-
- 0
-
-
- true
-
0
0
+
+ 0
+
+
+ true
+
Output
@@ -463,16 +479,16 @@
-
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
- QFrame::Plain
+ QFrame::Shadow::Plain
- Qt::ScrollBarAlwaysOff
+ Qt::ScrollBarPolicy::ScrollBarAlwaysOff
- QAbstractScrollArea::AdjustToContents
+ QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents
true
@@ -482,8 +498,8 @@
0
0
- 306
- 753
+ 304
+ 754
@@ -525,14 +541,14 @@
TextLabel
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -562,13 +578,13 @@
-
- QAbstractItemView::NoEditTriggers
+ QAbstractItemView::EditTrigger::NoEditTriggers
- QAbstractItemView::SingleSelection
+ QAbstractItemView::SelectionMode::SingleSelection
- QAbstractItemView::SelectRows
+ QAbstractItemView::SelectionBehavior::SelectRows
false
@@ -599,29 +615,29 @@
-
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
- QAbstractScrollArea::AdjustToContents
+ QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents
true
-
-
- 0
- 0
-
-
0
0
- 278
- 326
+ 139
+ 150
+
+
+ 0
+ 0
+
+
-
@@ -751,11 +767,11 @@
-
-
- 0
- 0
-
-
+
+ 0
+ 0
+
+
TextLabel
@@ -784,13 +800,13 @@
- QFrame::NoFrame
+ QFrame::Shape::NoFrame
- Qt::ScrollBarAlwaysOff
+ Qt::ScrollBarPolicy::ScrollBarAlwaysOff
- QAbstractScrollArea::AdjustToContents
+ QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents
true
@@ -800,8 +816,8 @@
0
0
- 294
- 741
+ 118
+ 329
@@ -822,7 +838,7 @@
- Qt::AlignCenter
+ Qt::AlignmentFlag::AlignCenter
@@ -849,16 +865,16 @@
- Qt::CustomContextMenu
+ Qt::ContextMenuPolicy::CustomContextMenu
- QAbstractItemView::NoEditTriggers
+ QAbstractItemView::EditTrigger::NoEditTriggers
- QAbstractItemView::SingleSelection
+ QAbstractItemView::SelectionMode::SingleSelection
- QAbstractItemView::SelectRows
+ QAbstractItemView::SelectionBehavior::SelectRows
false