I have a QTreeView and some of the items text gets truncated.
I want to display a tooltip for those items. The thing is that when i display the tooltip, its also truncated.
The word wrap only works with spaces. In my case i have a long email, and it cuts me the last 3 or 4 chars. i've tried adding the <p> tags so its rich text, and also just setting it with plain text, but still not working.
item->setToolTip(tooltip);
item->setToolTip("<p>" + tooltip+ "</p>"); //both have the same result
item->setToolTip(tooltip);
item->setToolTip("<p>" + tooltip+ "</p>"); //both have the same result
To copy to clipboard, switch view to plain text mode
The hack that i found is that, if i add as many " " (blanks) as the size of the text, then it gets displayed fine.
filler.fill(' ', tooltip.size());//we need this filler ir order for QT to not cut the long text in the tooltip.
item->setToolTip(tooltip + filler);
QString filler;
filler.fill(' ', tooltip.size());//we need this filler ir order for QT to not cut the long text in the tooltip.
item->setToolTip(tooltip + filler);
To copy to clipboard, switch view to plain text mode
If instead of using a variable i set a large text manually, it works great.
item->setToolTip("ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttX");
item->setToolTip("ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttX");
To copy to clipboard, switch view to plain text mode
any ideas?
thanks!
Bookmarks