diff --git a/src/slic3r/GUI/ObjectDataViewModel.cpp b/src/slic3r/GUI/ObjectDataViewModel.cpp
index 623a4aa38..c03a52e03 100644
--- a/src/slic3r/GUI/ObjectDataViewModel.cpp
+++ b/src/slic3r/GUI/ObjectDataViewModel.cpp
@@ -1512,10 +1512,10 @@ void ObjectDataViewModel::assembly_name(ObjectDataViewModelNode* item, wxString
auto type = this->GetItemType(wxDataViewItem(item));
if (type != itPlate) {
wxString str = name + ":" + item->GetName();
- assembly_name_list.push_back(std::make_pair(item, str));
+ assembly_name_list.push_back(std::make_tuple(item, str, str));
}
else {
- assembly_name_list.push_back(std::make_pair(item, name));
+ assembly_name_list.push_back(std::make_tuple(item, name, name));
}
for (size_t i = 0; i < item->GetChildCount(); ++i) {
wxString str_name = name + ":" + item->GetName();
@@ -1535,8 +1535,8 @@ void ObjectDataViewModel::search_object(wxString search_text)
search_found_list.clear();
search_text = search_text.MakeLower();
- for (const auto& pair : assembly_name_list) {
- wxString sub_str = pair.second;
+ for (const auto& [model_node, name, tip] : assembly_name_list) {
+ wxString sub_str = name;
sub_str = sub_str.MakeLower();
wxString new_str = "";
@@ -1544,18 +1544,18 @@ void ObjectDataViewModel::search_object(wxString search_text)
size_t curr_str_len = 0;
size_t pos = sub_str.find(search_text);
while (pos != wxString::npos) {
- wxString new_search_str = "" + pair.second.Mid(curr_str_len + pos, search_text_len) + "";
- new_str += pair.second.Mid(curr_str_len, pos) + new_search_str;
+ wxString new_search_str = "" + name.Mid(curr_str_len + pos, search_text_len) + "";
+ new_str += name.Mid(curr_str_len, pos) + new_search_str;
curr_str_len += search_text_len + pos;
- sub_str = sub_str.substr(pos + 1);
+ sub_str = sub_str.substr(pos + search_text_len);
pos = sub_str.find(search_text);
}
- if (curr_str_len > 0 && curr_str_len < pair.second.length()) {
- new_str += pair.second.substr(curr_str_len);
+ if (curr_str_len > 0 && curr_str_len < name.length()) {
+ new_str += name.substr(curr_str_len);
}
if (!new_str.empty())
- search_found_list.push_back(std::make_pair(pair.first, new_str));
+ search_found_list.push_back(std::tuple(model_node, new_str, tip));
}
}
}
diff --git a/src/slic3r/GUI/ObjectDataViewModel.hpp b/src/slic3r/GUI/ObjectDataViewModel.hpp
index 272bef2d5..009d8e61b 100644
--- a/src/slic3r/GUI/ObjectDataViewModel.hpp
+++ b/src/slic3r/GUI/ObjectDataViewModel.hpp
@@ -332,8 +332,8 @@ class ObjectDataViewModel :public wxDataViewModel
ObjectDataViewModelNode* m_plate_outside;
wxDataViewCtrl* m_ctrl { nullptr };
- std::vector> assembly_name_list;
- std::vector> search_found_list;
+ std::vector> assembly_name_list;
+ std::vector> search_found_list;
std::map m_ui_and_3d_volume_map;
public:
@@ -509,9 +509,9 @@ public:
void assembly_name(ObjectDataViewModelNode* item, wxString name);
void assembly_name();
- std::vector> get_assembly_name_list() { return assembly_name_list; }
+ std::vector> get_assembly_name_list() const { return assembly_name_list; }
void search_object(wxString search_text);
- std::vector> get_found_list() { return search_found_list; }
+ std::vector> get_found_list() const { return search_found_list; }
void sys_color_changed();
diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp
index 6184086dc..5579fb7bc 100644
--- a/src/slic3r/GUI/Search.cpp
+++ b/src/slic3r/GUI/Search.cpp
@@ -395,7 +395,7 @@ void OptionsSearcher::add_key(const std::string &opt_key, Preset::Type type, con
// SearchItem
//------------------------------------------
-SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog* sdialog, SearchObjectDialog* search_dialog)
+SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog* sdialog, SearchObjectDialog* search_dialog, wxString tooltip)
: wxWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(parent->GetSize().GetWidth(), 3 * GUI::wxGetApp().em_unit()))
{
m_sdialog = sdialog;
@@ -403,6 +403,8 @@ SearchItem::SearchItem(wxWindow *parent, wxString text, int index, SearchDialog*
m_text = text;
m_index = index;
+ this->SetToolTip(tooltip);
+
SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF")));
Bind(wxEVT_ENTER_WINDOW, &SearchItem::on_mouse_enter, this);
Bind(wxEVT_LEAVE_WINDOW, &SearchItem::on_mouse_leave, this);
@@ -997,13 +999,11 @@ void SearchObjectDialog::update_list()
m_listPanel->SetBackgroundColour(StateColor::darkModeColorFor(m_bg_color));
m_listPanel->SetSize(wxSize(m_scrolledWindow->GetSize().GetWidth(), -1));
- const std::vector>& found = m_object_list->GetModel()->get_found_list();
+ const std::vector>& found = m_object_list->GetModel()->get_found_list();
auto index = 0;
- for (const auto& item : found) {
- GUI::ObjectDataViewModelNode* data_item = item.first;
- wxString data_str = item.second;
- auto tmp = new SearchItem(m_listPanel, data_str, index, nullptr, this);
- tmp->m_item = data_item;
+ for (const auto& [model_node, name, tip] : found) {
+ auto tmp = new SearchItem(m_listPanel, name, index, nullptr, this, tip);
+ tmp->m_item = model_node;
m_listsizer->Add(tmp, 0, wxEXPAND, 0);
index++;
}
diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp
index 8d20a14e1..31b83b8cf 100644
--- a/src/slic3r/GUI/Search.hpp
+++ b/src/slic3r/GUI/Search.hpp
@@ -166,7 +166,7 @@ public:
SearchObjectDialog* m_search_object_dialog{ nullptr };
GUI::ObjectDataViewModelNode* m_item{ nullptr };
- SearchItem(wxWindow *parent, wxString text, int index, SearchDialog *sdialog = nullptr, SearchObjectDialog* search_dialog = nullptr);
+ SearchItem(wxWindow *parent, wxString text, int index, SearchDialog *sdialog = nullptr, SearchObjectDialog* search_dialog = nullptr, wxString tooltip = "");
~SearchItem(){};
wxSize DrawTextString(wxDC &dc, const wxString &text, const wxPoint &pt, bool bold);