In my Qt application, I'd like to use balloons/balloon-tips as shown in the Windows user experience guide (not the system tray balloons).
Is this supported by Qt? I haven't found anything. Is there an Open Source library out there for this (Qxt does not have it)? What's the best way to create that myself?
You can use QBalloonTip
which is an internal class defined in :
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.
To use private class QBaloonTip
in Qt 5.12 you need to do the following:
1) add QT += widgets-private
to your PRO file to be able to include private headers
2) #include <QtWidgets/private/qsystemtrayicon_p.h>
in your source file
Then call static method showBallon()
or instantiate it and call baloon()
. But it is really only for system tray and it is a private API, which can change any time. I personally would not use it. But if you want to know how it is rendered, have a look at https://code.woboq.org/qt5/qtbase/src/widgets/util/qsystemtrayicon.cpp.html#_ZN11QBalloonTip10paintEventEP11QPaintEvent
Search for QBalloonTip
class (in Qt documentation (doxygen reference) and code base, look how it is implemented, and use similar technique.