From db514c6a2517e01dd2dc20c155762032a35dce90 Mon Sep 17 00:00:00 2001 From: Dieter Mayer Date: Wed, 29 Jul 2026 12:32:22 +0200 Subject: [PATCH] Element panel: show name and element information in the tooltip The element tooltip showed only the collection path - the least useful string exactly when a long descriptive name is truncated in the tree (qelectrotech#552). Show instead: localized name, description, manufacturer and manufacturer reference (each only when set), with the collection path kept as the last line. Directories and .qetmak entries keep the plain path tooltip. Reuses the location/context already parsed right above for the search index, so no additional file access or parsing. GUI-verified on a library where every element carries these fields: hovering an element now shows e.g. name, "Hutschienennetzteil 85-264VAC auf 24VDC, 92W, Schutzklasse II", manufacturer, order number and path on five lines. --- .../fileelementcollectionitem.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 15274722c..b14e86088 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -327,6 +327,26 @@ void FileElementCollectionItem::setUpData() { search_list.append(context.value(key).toString()); } search_list.append(localName(loc)); setData(search_list.join(" ")); + + // Tooltip: show what a truncated tree label can't - the full + // localized name and the descriptive element information. + // Reuses the location/context already parsed for the search + // index above; the collection path stays as the last line + // (it used to be the whole tooltip). + QStringList tip; + tip << localName(loc); + for (const auto &key : { QStringLiteral("description"), + QStringLiteral("manufacturer"), + QStringLiteral("manufacturer_reference") }) + { + const QString value = context.value(key).toString(); + if (!value.isEmpty()) + tip << value; + } + tip << collectionPath(); + tip.removeDuplicates(); + setToolTip(tip.join(QLatin1Char('\n'))); + return; } }