本文整理汇总了C++中QToolButton::toolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::toolTip方法的具体用法?C++ QToolButton::toolTip怎么用?C++ QToolButton::toolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::toolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSetToolTipBeforeRequestingToolButtonWidget
void KSelectAction_UnitTest::testSetToolTipBeforeRequestingToolButtonWidget()
{
KSelectAction selectAction("selectAction", 0);
selectAction.setToolBarMode(KSelectAction::MenuMode);
selectAction.setToolTip("Test");
QToolBar toolBar;
//Don't use requestWidget, as it needs a releaseWidget when used in MenuMode
//(in ComboBoxMode the widget is released automatically when it is
//destroyed). When the action is added to the QToolBar, it requests and
//releases the widget as needed.
toolBar.addAction(&selectAction);
QWidget* widget = toolBar.widgetForAction(&selectAction);
QVERIFY(widget);
QToolButton* toolButton = qobject_cast<QToolButton*>(widget);
QVERIFY(toolButton);
QCOMPARE(toolButton->toolTip(), QString("Test"));
}
示例2: addDummyButton
QToolButton* LaunchPad::addDummyButton()
{
QToolButton* button = ButtonPad::addDummyButton();
QString tt = cDummyTip;
tt.append("\n");
tt.append(button->toolTip());
button->setToolTip(tt);
button->setText("Echo");
QString cmd("echo Dummy button clicked: "
"SymbolType=[Provider] "
"Symbol=[Symbol] Market=[Market] "
"FiId=[FiId] MarketId=[MarketId]");
mCommands.append(cmd);
mSymbolTypes.append("");
mMultis.append(true);
return button;
}
示例3: eventFilter
bool KateViewSpace::eventFilter(QObject *obj, QEvent *event)
{
QToolButton *button = qobject_cast<QToolButton *>(obj);
// quick open button: show tool tip with shortcut
if (button == m_quickOpen && event->type() == QEvent::ToolTip) {
QHelpEvent *e = static_cast<QHelpEvent *>(event);
QAction *quickOpen = m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_quick_open"));
Q_ASSERT(quickOpen);
QToolTip::showText(e->globalPos(),
button->toolTip() + QStringLiteral(" (%1)").arg(quickOpen->shortcut().toString()), button);
return true;
}
// quick open button: What's This
if (button == m_quickOpen && event->type() == QEvent::WhatsThis) {
QHelpEvent *e = static_cast<QHelpEvent *>(event);
const int hiddenDocs = hiddenDocuments();
QString helpText = (hiddenDocs == 0)
? i18n("Click here to switch to the Quick Open view.")
: i18np("Currently, there is one more document open. To see all open documents, switch to the Quick Open view by clicking here.",
"Currently, there are %1 more documents open. To see all open documents, switch to the Quick Open view by clicking here.",
hiddenDocs);
QWhatsThis::showText(e->globalPos(), helpText, m_quickOpen);
return true;
}
// on mouse press on view space bar tool buttons: activate this space
if (button && ! isActiveSpace() && event->type() == QEvent::MouseButtonPress) {
m_viewManager->setActiveSpace(this);
if (currentView()) {
m_viewManager->activateView(currentView()->document());
}
}
return false;
}