mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-03 02:24:13 +02:00
Merge pull request #571 from DieterMayerOSS/pr/element-panel-tooltip
Element panel: show name and element information in the tooltip
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user