summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Kothmeier <floriankothmeier@web.de>2023-06-27 16:22:58 +0200
committerFlorian Kothmeier <floriankothmeier@web.de>2023-06-29 15:01:36 +0200
commitc33748d954a279edd8c42a58f14efa88719f4111 (patch)
tree777764a1e9236a2b09132abe275cbe6a131ae4d1
parent16dd4e5725a2576ba5765f9f15bccb519b83482c (diff)
downloadredot-engine-c33748d954a279edd8c42a58f14efa88719f4111.tar.gz
Fix invalid minimum size for translated messages in option button
-rw-r--r--scene/gui/option_button.cpp2
-rw-r--r--scene/gui/popup_menu.cpp5
-rw-r--r--scene/gui/popup_menu.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 451ac94109..71d64c8bff 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -451,7 +451,7 @@ void OptionButton::_refresh_size_cache() {
_cached_size = Vector2();
for (int i = 0; i < get_item_count(); i++) {
- _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(get_item_text(i), get_item_icon(i)));
+ _cached_size = _cached_size.max(get_minimum_size_for_text_and_icon(popup->get_item_xl_text(i), get_item_icon(i)));
}
update_minimum_size();
}
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index adeaf9a49f..94690a4938 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -1471,6 +1471,11 @@ String PopupMenu::get_item_text(int p_idx) const {
return items[p_idx].text;
}
+String PopupMenu::get_item_xl_text(int p_idx) const {
+ ERR_FAIL_INDEX_V(p_idx, items.size(), "");
+ return items[p_idx].xl_text;
+}
+
Control::TextDirection PopupMenu::get_item_text_direction(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, items.size(), Control::TEXT_DIRECTION_INHERITED);
return items[p_idx].text_direction;
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index 572467bf94..b4655f13ae 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -250,6 +250,7 @@ public:
void toggle_item_checked(int p_idx);
String get_item_text(int p_idx) const;
+ String get_item_xl_text(int p_idx) const;
Control::TextDirection get_item_text_direction(int p_idx) const;
String get_item_language(int p_idx) const;
int get_item_idx_from_text(const String &text) const;