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 :Qt 5:
QtDir/Src/qtbase/src/widgets/util/qsystemtrayicon_p.h
Qt 4:
QtDir/src/gui/utils/util/qsystemtrayicon_p.h
QBalloonTip
inheritsQWidget
and it is implemented inqsystemtrayicon.cpp
at the same directory. It has the following method to show a balloon tip: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 headers2)
#include <QtWidgets/private/qsystemtrayicon_p.h>
in your source fileThen call static method
showBallon()
or instantiate it and callbaloon()
. 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#_ZN11QBalloonTip10paintEventEP11QPaintEventSearch for
QBalloonTip
class (in Qt documentation (doxygen reference) and code base, look how it is implemented, and use similar technique.