本文整理汇总了C++中QTabWidget::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::addAction方法的具体用法?C++ QTabWidget::addAction怎么用?C++ QTabWidget::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::addAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setStandardKeys
//.........这里部分代码省略.........
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
}
}
if (!hasShortcut)
{
QDialogButtonBox* bb = widget->findChild<QDialogButtonBox*>();
if (bb)
{
QList<QAbstractButton*> buttons = bb->buttons();
for (int i = 0; i < buttons.size(); ++i)
{
QAbstractButton *bbutton = buttons.at(i);
QDialogButtonBox::ButtonRole btnrole = bb->buttonRole(buttons.at(i));
if (btnrole == QDialogButtonBox::AcceptRole)
{
bbutton->setShortcut(QKeySequence::Save);
bbutton->setToolTip(bbutton->text().remove("&") + " " +
bbutton->shortcut().toString(QKeySequence::NativeText));
}
else if (btnrole == QDialogButtonBox::RejectRole)
{
bbutton->setShortcut(QKeySequence::Close);
bbutton->setToolTip(bbutton->text().remove("&") + " " +
bbutton->shortcut().toString(QKeySequence::NativeText));
}
}
}
}
// For Close
hasShortcut = false;
button = widget->findChild<QPushButton*>("_close");
if (button)
{
button->setShortcut(QKeySequence::Close);
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
hasShortcut = true;
}
if (!hasShortcut) // Because some screens have both
{
// For Post
button = widget->findChild<QPushButton*>("_cancel");
if (button)
{
button->setShortcut(QKeySequence::Close);
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
}
}
// For New
button = widget->findChild<QPushButton*>("_new");
if (button)
{
button->setShortcut(QKeySequence::New);
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
hasShortcut = true;
}
// For Print
button = widget->findChild<QPushButton*>("_print");
if (button)
{
button->setShortcut(QKeySequence::Print);
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
hasShortcut = true;
}
// For Query
button = widget->findChild<QPushButton*>("_query");
if (button)
{
button->setShortcut(QKeySequence::Refresh);
button->setToolTip(button->text().remove("&") + " " +
button->shortcut().toString(QKeySequence::NativeText));
hasShortcut = true;
}
// Page up/down for tab widgets
QTabWidget* tab = widget->findChild<QTabWidget*>();
if (tab)
{
TabWidgetNavigtor* tabNav = new TabWidgetNavigtor(tab, widget);
QAction* pagedownAct = new QAction(tab);
pagedownAct->setShortcut(QKeySequence::MoveToNextPage);
pagedownAct->connect(pagedownAct, SIGNAL(triggered()), tabNav, SLOT(pageDown()));
tab->addAction(pagedownAct);
QAction* pageupAct = new QAction(tab);
pageupAct->setShortcut(QKeySequence::MoveToPreviousPage);
pageupAct->connect(pageupAct, SIGNAL(triggered()), tabNav, SLOT(pageUp()));
tab->addAction(pageupAct);
}
}