diff options
Diffstat (limited to 'scene/gui/tab_bar.cpp')
-rw-r--r-- | scene/gui/tab_bar.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp index 3e0d6adf42..6cc7ec3bd5 100644 --- a/scene/gui/tab_bar.cpp +++ b/scene/gui/tab_bar.cpp @@ -354,6 +354,8 @@ void TabBar::_notification(int p_what) { if (scroll_to_selected) { ensure_tab_visible(current); } + // Set initialized even if no tabs were set. + initialized = true; } break; case NOTIFICATION_INTERNAL_PROCESS: { @@ -655,10 +657,10 @@ void TabBar::set_tab_count(int p_count) { } if (!initialized) { - if (queued_current != current) { - current = queued_current; - } initialized = true; + if (queued_current != CURRENT_TAB_UNINITIALIZED && queued_current != current) { + set_current_tab(queued_current); + } } queue_redraw(); @@ -740,6 +742,13 @@ bool TabBar::select_next_available() { return false; } +void TabBar::set_tab_offset(int p_offset) { + ERR_FAIL_INDEX(p_offset, tabs.size()); + offset = p_offset; + _update_cache(); + queue_redraw(); +} + int TabBar::get_tab_offset() const { return offset; } @@ -1250,6 +1259,7 @@ Variant TabBar::_handle_get_drag_data(const String &p_type, const Point2 &p_poin } Label *label = memnew(Label(get_tab_title(tab_over))); + label->set_auto_translate_mode(get_auto_translate_mode()); // Reflect how the title is displayed. drag_preview->add_child(label); set_drag_preview(drag_preview); |