问题描述
在我的Qt应用程序中,我想使用如 Windows用户体验指南(不是系统任务栏气球).
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).
Qt支持吗?我什么都没找到是否有一个开放源代码库(Qxt没有它)?创建自己的最佳方法是什么?
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?
推荐答案
要在Qt 5.12中使用私有类QBaloonTip
,您需要执行以下操作:
To use private class QBaloonTip
in Qt 5.12 you need to do the following:
1)将QT += widgets-private
添加到您的PRO文件中,以便能够包含私有标头
1) add QT += widgets-private
to your PRO file to be able to include private headers
2)#include <QtWidgets/private/qsystemtrayicon_p.h>
在您的源文件中
然后调用静态方法showBallon()
或实例化它,然后调用baloon()
.但这实际上仅适用于系统任务栏,并且是一个私有API,可以随时更改.我个人不会使用它.但是,如果您想知道它的呈现方式,请查看 https://code.woboq.org/qt5/qtbase/src/widgets/util/qsystemtrayicon.cpp.html#_ZN11QBalloonTip10paintEventEP11QPaintEvent
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
这篇关于Qt气球提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!