Qt Whats This 使用链接/锚点
如何将锚点 放入小部件的
whatsThis
中并拦截它被单击?
我知道 QLabel 中的 linkActivated
或 QTextBrowser 中的 linkClicked
,但我不知道如何使用 Whats This 文本执行相同的操作。
需要明确的是,我想知道如果不拦截帮助事件并自行管理 WhatsThis 机制,这是否可能。
How can I put an anchor <a>
into a whatsThis
for a widget an intercept it being clicked?
I know about linkActivated
in a QLabel, or linkClicked
in a QTextBrowser, but I don't know how I can do the same thing with a Whats This text.
To be clear, I want to know if this is possible without interception help events and managing the WhatsThis mechanism on my own.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解你的问题,那就是你想知道是否有一个 SIGNAL() 。似乎没有。似乎您必须通过派生您自己的 Widget 类或使用某种全局过滤器来监视
QWhatsThisClickedEvent
:http://qtcentre.org/archive/index.php/t-7394.html
仅供参考,实际点
QWhatsThisClickedEvent
在 Qt 源中发出:http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/kernel/qwhatsthis.cpp#line264
If I understand your question, it's that you want to know if there is a
SIGNAL()
for this. There does not appear to be. Seems you have to watch for theQWhatsThisClickedEvent
by deriving your own Widget class or with some kind of global filter:http://qtcentre.org/archive/index.php/t-7394.html
FYI, the actual point where the
QWhatsThisClickedEvent
is emitted in the Qt sources is here:http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/kernel/qwhatsthis.cpp#line264
HostileFork 的答案几乎就是金钱。除非您有自己捕获 WhatsThisClicked 事件的小部件,否则一种可能有效的简单方法是在主窗口小部件中侦听 WhatsThisClicked 事件。代码非常简单,如下所示:
HostileFork's answer is pretty much on the money. One simple approach that may work unless you have widgets which catch
WhatsThisClicked
events themselves is to listen forWhatsThisClicked
events in your main window's widget. The code is pretty simple, something like the following: