Skip to content
Open
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
8 changes: 5 additions & 3 deletions src/slic3r/GUI/Widgets/DropDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ int DropDown::hoverIndex()
{
if (hover_item < 0)
return -1;
if (count == items.size())
// Counts also match when every group holds one item, so check has_groups too
if (count == items.size() && !has_groups)
return hover_item;
int index = -1;
std::set<wxString> groups;
Expand Down Expand Up @@ -446,7 +447,7 @@ int DropDown::selectedItem()
{
if (selection < 0)
return -1;
if (count == items.size())
if (count == items.size() && !has_groups)
return selection;
auto & sel = items[selection];
if (group.IsEmpty() ? !sel.group.IsEmpty() : sel.group != group)
Expand Down Expand Up @@ -559,6 +560,7 @@ void DropDown::messureSize()
// Gtk has a wrapper window for popup widget
gtk_window_resize (GTK_WINDOW (m_widget), szContent.x, szContent.y);
#endif
has_groups = !groups.empty();
if (!groups.empty() && subDropDown == nullptr) {
subDropDown = new DropDown(items);
subDropDown->mainDropDown = this;
Expand Down Expand Up @@ -715,7 +717,7 @@ void DropDown::mouseMove(wxMouseEvent &event)
if (hover == hover_item) return;
hover_item = hover;
int index = hoverIndex();
if (index < -1) {
if (index < -1 && subDropDown) {
auto & drop = *subDropDown;
drop.group = items[-index - 2].group;
drop.need_sync = true;
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Widgets/DropDown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DropDown : public PopupWindow
private:
std::vector<Item> &items;
size_t count = 0;
bool has_groups = false; // set by messureSize()
wxString group;
bool need_sync = false;
int selection = -1;
Expand Down