mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-03 10:34:14 +02:00
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.
This commit is contained in:
@@ -327,6 +327,26 @@ void FileElementCollectionItem::setUpData()
|
|||||||
{ search_list.append(context.value(key).toString()); }
|
{ search_list.append(context.value(key).toString()); }
|
||||||
search_list.append(localName(loc));
|
search_list.append(localName(loc));
|
||||||
setData(search_list.join(" "));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user