Question

I have Qt 5.2.1 widgets-based project. I want to show cool tooltip with arrow while user hovers some labels (or any other widgets that can show image), like this:

qtooltip with arrow

But i found no examples for this. So am i able to do this with QToolTip? Or should i use another widgets to reach same look instead?

It is no matter what classes and styles i have to use, i need to reach similar effect any way.

I've tried to customize QToolTip with basic CSS but had failed.

Était-ce utile?

La solution

You can use QBalloonTip which is an internal class defined in

QtDir/5.2.1/Src/qtbase/src/widgets/util/qsystemtrayicon_p.h

QBalloonTip inherits QWidget and it is implemented in qsystemtrayicon.cpp at the same directory. It has the following method to show a balloon tip:

void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)

You can modify the source code of this class to have your desired balloon tip.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top