summaryrefslogtreecommitdiff
path: root/scene/gui/dialogs.cpp
diff options
context:
space:
mode:
authorvolzhs <volzhs@gmail.com>2016-10-31 03:42:30 +0900
committervolzhs <volzhs@gmail.com>2016-10-31 03:42:30 +0900
commit8d5644c4b217636994440f698b09ef395e5dfa55 (patch)
treea36f9600197896c65e284f3353056786d31d25cc /scene/gui/dialogs.cpp
parent3f15a65307c0a3c2c4769af964356996ed367c35 (diff)
Fix Accept/ConfirmationDialog UI broken
Diffstat (limited to 'scene/gui/dialogs.cpp')
-rw-r--r--scene/gui/dialogs.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 15ff334c92..49782bcb75 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -232,6 +232,8 @@ String AcceptDialog::get_text() const {
void AcceptDialog::set_text(String p_text) {
label->set_text(p_text);
+ minimum_size_changed();
+ _update_child_rect();
}
void AcceptDialog::set_hide_on_ok(bool p_hide) {
@@ -252,15 +254,16 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) {
}
void AcceptDialog::_update_child_rect() {
-
+ Size2 label_size=label->get_minimum_size();
+ if (label->get_text().empty()) {
+ label_size.height = 0;
+ }
int margin = get_constant("margin","Dialogs");
Size2 size = get_size();
Size2 hminsize = hbc->get_combined_minimum_size();
- Vector2 cpos(margin,margin);
- Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y);
- label->set_pos(cpos);
- label->set_size(csize);
+ Vector2 cpos(margin,margin+label_size.height);
+ Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y-label_size.height);
if (child) {