summaryrefslogtreecommitdiffstats
path: root/scene/gui/option_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/option_button.cpp')
-rw-r--r--scene/gui/option_button.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index f9740b1217..45cc9623be 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -60,7 +60,7 @@ Size2 OptionButton::get_minimum_size() const {
}
if (has_theme_icon(SNAME("arrow"))) {
- const Size2 padding = theme_cache.normal->get_minimum_size();
+ const Size2 padding = _get_current_stylebox()->get_minimum_size();
const Size2 arrow_size = theme_cache.arrow_icon->get_size();
Size2 content_size = minsize - padding;
@@ -159,7 +159,7 @@ void OptionButton::_notification(int p_what) {
bool OptionButton::_set(const StringName &p_name, const Variant &p_value) {
Vector<String> components = String(p_name).split("/", true, 2);
if (components.size() >= 2 && components[0] == "popup") {
- String property = components[2];
+ const String &property = components[2];
if (property != "text" && property != "icon" && property != "id" && property != "disabled" && property != "separator") {
return false;
}
@@ -186,7 +186,7 @@ bool OptionButton::_set(const StringName &p_name, const Variant &p_value) {
bool OptionButton::_get(const StringName &p_name, Variant &r_ret) const {
Vector<String> components = String(p_name).split("/", true, 2);
if (components.size() >= 2 && components[0] == "popup") {
- String property = components[2];
+ const String &property = components[2];
if (property != "text" && property != "icon" && property != "id" && property != "disabled" && property != "separator") {
return false;
}
@@ -605,6 +605,8 @@ void OptionButton::set_disable_shortcuts(bool p_disabled) {
OptionButton::OptionButton(const String &p_text) :
Button(p_text) {
+ _set_h_separation_is_valid_when_no_text(true);
+
set_toggle_mode(true);
set_process_shortcut_input(true);
set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT);