Is it, maybe by using some dirty hakish stuff, possible to use a QWidget
as a tooltip or archive a similar mechanic?
I want to have such a thing, because I have a list of some participants for a contest and would like to use a QListView
for displaying everyone inside that contest when I hover the total participant count. I'm using Qt5.3
.
-
You may want to have a look at this api.kde.org/frameworks/kwidgetsaddons/html/…– HiFile.app - best file managerCommented Oct 26, 2022 at 9:26
1 Answer
A QToolTip
can contain and display rich text, so you could create a the look of a table by using the HTML tags that are supported (see here).
If that does not suffice for your case, then you could always create your custom widget and display it at the right time by listening to the right events: QEvent::ToolTip
would seem the right one.
Overriding QWidget::event(QEvent *)
would give you something like:
bool MyWidget::event(QEvent * event) override
{
if ( event->type() == QEvent::ToolTip )
{
myToolTip_->show();
}
}
But then you'd need to place your tooltip widget at the correct position, take care of hiding it when not needed anymore and so on... So I'd try the rich text version first.