在QWidget中的几个Tip的不同, toolTip, statusTip, whatsThis?

neicole 2012-08-10 10:08:29
statusTip : QString
This property holds the widget's status tip.
By default, this property contains an empty string.


toolTip : QString
This property holds the widget's tooltip.
Note that by default tooltips are only shown for widgets that are children of the active window. You can change this behavior by setting the attribute Qt::WA_AlwaysShowToolTips on the window, not on the widget with the tooltip.
If you want to control a tooltip's behavior, you can intercept the event() function and catch the QEvent::ToolTip event (e.g., if you want to customize the area for which the tooltip should be shown).
By default, this property contains an empty string.



whatsThis : QString
This property holds the widget's What's This help text.
By default, this property contains an empty string.


纠结,在看Qt文档的时候,感觉看了跟没看一样,还是不能怎么理解~
现在在用QComboBox,想实现鼠标移到QComboBox的时候就能在鼠标旁有一个文本框文字提示一下下,不过不知道用哪个Tip还是使用Event?
就我自己做过的,就只做过toolTip,我理解是这样的,toolTip设定了的时候会在状态栏那里显示。
然后另外两个就没有试过了,字面理解的话,第一个指定状态?第二个使用于帮助?

那如果我想实现上述功能的话,是要用第三个?
...全文
1389 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
neicole 2012-08-11
  • 打赏
  • 举报
回复
好吧~ 是时候结帖了~
neicole 2012-08-10
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]
myWidget -> setStatusTip ("StatusTip");//状态栏提示
myWidget -> setToolTip ("ToolTip"); //鼠标放到控件上,浮动出一个小黄框。
myWidget -> setWhatsThis ("WhatsThis");//QDialog 标题栏上有一个?按钮,先点按钮鼠标变问号,再点控件。
[/Quote]

哦,这么一提醒,那我明白了,就是说像Qt Creator的时候,打出关键字,然后弹个小小的F1出来的那时候的效果。
jdwx 2012-08-10
  • 打赏
  • 举报
回复
myWidget -> setStatusTip ("StatusTip");//状态栏提示
myWidget -> setToolTip ("ToolTip"); //鼠标放到控件上,浮动出一个小黄框。
myWidget -> setWhatsThis ("WhatsThis");//QDialog 标题栏上有一个?按钮,先点按钮鼠标变问号,再点控件。
neicole 2012-08-10
  • 打赏
  • 举报
回复
// main.cpp

#include <QApplication>
#include <QTextCodec>

#include <QWidget>
#include <QLabel>
#include <QDebug>

int main(int argc, char * argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); // 中文显示

QWidget * myWidget = new QWidget();

myWidget -> setStatusTip ("StatusTip");
myWidget -> setToolTip ("ToolTip"); // 这里有反应。。。
myWidget -> setWhatsThis ("WhatsThis");


myWidget -> show();
return app.exec();
}


那其它的两个应该是在什么时候显示的呢?
neicole 2012-08-10
  • 打赏
  • 举报
回复
// main.cpp

#include <QApplication>
#include <QTextCodec>

#include <QWidget>
#include <QLabel>
#include <QDebug>

int main(int argc, char * argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); // 中文显示

QWidget * myWidget = new QWidget();

myWidget -> setStatusTip ("StatusTip");
myWidget -> setToolTip ("ToolTip"); // 这里有反应。。。
myWidget -> setWhatsThis ("WhatsThis");


myWidget -> show();
return app.exec();
}


那其它的两个应该是在什么时候显示的呢?
neicole 2012-08-10
  • 打赏
  • 举报
回复
那个。。。。 跟想像中的答案差不多~ 都是跟我去试。。。

IT精神啊~

SilenceSu 2012-08-10
  • 打赏
  • 举报
回复
就3个 都试试就知道了嘛!
刀刀亮 2012-08-10
  • 打赏
  • 举报
回复
用whatsThis。楼主要是不确定可以每一个都试一下 啊

16,816

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧