Merge pull request 'fix(ui): add tooltip fallback for truncated tree item names (#193)' (#239) from fix/tree-tooltip-fallback into main
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
Reviewed-on: #239
This commit was merged in pull request #239.
This commit is contained in:
@@ -3203,6 +3203,7 @@ void TreeWidget::slotNewDocument(const Gui::Document& Doc, bool isMainDoc)
|
||||
}
|
||||
item->setIcon(0, *documentPixmap);
|
||||
item->setText(0, QString::fromUtf8(Doc.getDocument()->Label.getValue()));
|
||||
item->setToolTip(0, item->text(0));
|
||||
DocumentMap[&Doc] = item;
|
||||
}
|
||||
|
||||
@@ -3317,7 +3318,9 @@ void TreeWidget::slotRelabelDocument(const Gui::Document& Doc)
|
||||
{
|
||||
auto it = DocumentMap.find(&Doc);
|
||||
if (it != DocumentMap.end()) {
|
||||
it->second->setText(0, QString::fromUtf8(Doc.getDocument()->Label.getValue()));
|
||||
auto label = QString::fromUtf8(Doc.getDocument()->Label.getValue());
|
||||
it->second->setText(0, label);
|
||||
it->second->setToolTip(0, label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4440,10 +4443,13 @@ bool DocumentItem::createNewItem(
|
||||
}
|
||||
assert(item->parent() == parent);
|
||||
item->setText(0, QString::fromUtf8(data->label.c_str()));
|
||||
item->setToolTip(0, item->text(0));
|
||||
if (!data->label2.empty()) {
|
||||
item->setText(1, QString::fromUtf8(data->label2.c_str()));
|
||||
item->setToolTip(1, item->text(1));
|
||||
}
|
||||
item->setText(2, QString::fromUtf8(data->internalName.c_str()));
|
||||
item->setToolTip(2, item->text(2));
|
||||
if (!obj.showInTree() && !showHidden()) {
|
||||
item->setHidden(true);
|
||||
}
|
||||
@@ -4975,6 +4981,7 @@ void TreeWidget::slotChangeObject(const Gui::ViewProviderDocumentObject& view, c
|
||||
auto displayName = QString::fromUtf8(label);
|
||||
for (auto item : data->items) {
|
||||
item->setText(0, displayName);
|
||||
item->setToolTip(0, displayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4990,6 +4997,7 @@ void TreeWidget::slotChangeObject(const Gui::ViewProviderDocumentObject& view, c
|
||||
auto displayName = QString::fromUtf8(label);
|
||||
for (auto item : data->items) {
|
||||
item->setText(1, displayName);
|
||||
item->setToolTip(1, displayName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user