Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TabContainer drag to rearrange issue #83966

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scene/gui/tab_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,23 @@ Vector<Control *> TabContainer::_get_tab_controls() const {
}

Variant TabContainer::_get_drag_data_fw(const Point2 &p_point, Control *p_from_control) {
if (!drag_to_rearrange_enabled) {
return Variant();
}
return tab_bar->_handle_get_drag_data("tab_container_tab", p_point);
}

bool TabContainer::_can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) const {
if (!drag_to_rearrange_enabled) {
return false;
}
return tab_bar->_handle_can_drop_data("tab_container_tab", p_point, p_data);
}

void TabContainer::_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from_control) {
if (!drag_to_rearrange_enabled) {
return;
}
return tab_bar->_handle_drop_data("tab_container_tab", p_point, p_data, callable_mp(this, &TabContainer::_drag_move_tab), callable_mp(this, &TabContainer::_drag_move_tab_from));
}

Expand Down Expand Up @@ -815,11 +824,11 @@ Popup *TabContainer::get_popup() const {
}

void TabContainer::set_drag_to_rearrange_enabled(bool p_enabled) {
tab_bar->set_drag_to_rearrange_enabled(p_enabled);
drag_to_rearrange_enabled = p_enabled;
}

bool TabContainer::get_drag_to_rearrange_enabled() const {
return tab_bar->get_drag_to_rearrange_enabled();
return drag_to_rearrange_enabled;
}

void TabContainer::set_tabs_rearrange_group(int p_group_id) {
Expand Down
1 change: 1 addition & 0 deletions scene/gui/tab_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class TabContainer : public Container {
bool use_hidden_tabs_for_min_size = false;
bool theme_changing = false;
Vector<Control *> children_removing;
bool drag_to_rearrange_enabled = false;

struct ThemeCache {
int side_margin = 0;
Expand Down
Loading