Merge pull request #30923 from NilsIrl/better_dropdown
Improve platform selection in the GDNativeLibrary dock
This commit is contained in:
commit
baa1d0c3d0
1 changed files with 8 additions and 2 deletions
|
@ -67,12 +67,17 @@ void GDNativeLibraryEditor::_update_tree() {
|
||||||
TreeItem *root = tree->create_item();
|
TreeItem *root = tree->create_item();
|
||||||
|
|
||||||
PopupMenu *filter_list = filter->get_popup();
|
PopupMenu *filter_list = filter->get_popup();
|
||||||
|
String text = "";
|
||||||
for (int i = 0; i < filter_list->get_item_count(); i++) {
|
for (int i = 0; i < filter_list->get_item_count(); i++) {
|
||||||
|
|
||||||
if (!filter_list->is_item_checked(i)) {
|
if (!filter_list->is_item_checked(i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Map<String, NativePlatformConfig>::Element *E = platforms.find(filter_list->get_item_metadata(i));
|
Map<String, NativePlatformConfig>::Element *E = platforms.find(filter_list->get_item_metadata(i));
|
||||||
|
if (!text.empty()) {
|
||||||
|
text += ", ";
|
||||||
|
}
|
||||||
|
text += E->get().name;
|
||||||
|
|
||||||
TreeItem *platform = tree->create_item(root);
|
TreeItem *platform = tree->create_item(root);
|
||||||
platform->set_text(0, E->get().name);
|
platform->set_text(0, E->get().name);
|
||||||
|
@ -122,6 +127,7 @@ void GDNativeLibraryEditor::_update_tree() {
|
||||||
|
|
||||||
platform->set_collapsed(collapsed_items.find(E->get().name) != NULL);
|
platform->set_collapsed(collapsed_items.find(E->get().name) != NULL);
|
||||||
}
|
}
|
||||||
|
filter->set_text(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) {
|
void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) {
|
||||||
|
@ -339,11 +345,11 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
|
||||||
label->set_text(TTR("Platform:"));
|
label->set_text(TTR("Platform:"));
|
||||||
hbox->add_child(label);
|
hbox->add_child(label);
|
||||||
filter = memnew(MenuButton);
|
filter = memnew(MenuButton);
|
||||||
filter->set_text(TTR("Choose platform"));
|
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||||
|
filter->set_text_align(filter->ALIGN_LEFT);
|
||||||
hbox->add_child(filter);
|
hbox->add_child(filter);
|
||||||
PopupMenu *filter_list = filter->get_popup();
|
PopupMenu *filter_list = filter->get_popup();
|
||||||
filter_list->set_hide_on_checkable_item_selection(false);
|
filter_list->set_hide_on_checkable_item_selection(false);
|
||||||
filter_list->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
|
for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
|
||||||
|
|
Loading…
Reference in a new issue