QToolTip 的使用
高级用法,使用类型的 QEvent::ToolTip 的 QHelpEvent 事件(注意ignore使用)
bool SortingBox::event(QEvent *event) { if (event->type() == QEvent::ToolTip) { QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); if (xxxxxx) { QToolTip::showText(helpEvent->globalPos(), "xxxxxxxxx"); } else { QToolTip::hideText(); event->ignore(); } return true; }?return QWidget::event(event); }立即显示 tooltip,就像上面用的,直接调用 showText()
来源:http://hi.baidu.com/cyclone/blog/item/825759824a9782ad0cf4d2f7.html