本文整理汇总了C++中KAction::setShortcutContext方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::setShortcutContext方法的具体用法?C++ KAction::setShortcutContext怎么用?C++ KAction::setShortcutContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::setShortcutContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupActions
void FileManager::setupActions()
{
KAction* action = new KAction(this);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setText(i18n("Current Document Directory"));
action->setIcon(KIcon("dirsync"));
connect(action, SIGNAL(triggered(bool)), this, SLOT(syncCurrentDocumentDirectory()));
tbActions << (dirop->actionCollection()->action("back"));
tbActions << (dirop->actionCollection()->action("up"));
tbActions << (dirop->actionCollection()->action("home"));
tbActions << (dirop->actionCollection()->action("forward"));
tbActions << (dirop->actionCollection()->action("reload"));
tbActions << action;
tbActions << (dirop->actionCollection()->action("sorting menu"));
tbActions << (dirop->actionCollection()->action("show hidden"));
newFileAction = new KAction(this);
newFileAction->setText(i18n("New File..."));
newFileAction->setIcon(KIcon("document-new"));
connect(newFileAction, SIGNAL(triggered()), this, SLOT(createNewFile()));
}
示例2: QTreeView
CCppcheckWidget::CCppcheckWidget(QWidget* inpParent,
CCppcheckPlugin *inpCppcheckPlugin) :
QTreeView(inpParent),
m_pCppcheckPlugin(inpCppcheckPlugin)
{
setObjectName("cppcheck plugin report");
setWindowTitle("cppcheck");
setWindowIcon(KIcon("cppcheck"));
setRootIsDecorated(true);
setWhatsThis("cppcheck plugin report");
setModel(m_pCppcheckPlugin->getModel());
KAction *pCheckCurrentFile = new KAction(this);
pCheckCurrentFile->setShortcutContext(Qt::WidgetWithChildrenShortcut);
pCheckCurrentFile->setText(i18n("(Re-)launch cppcheck on the current file"));
pCheckCurrentFile->setToolTip(i18n("(Re-)launch cppcheck on the current file"));
pCheckCurrentFile->setIcon(KIcon("view-refresh"));
connect(pCheckCurrentFile, SIGNAL(triggered(bool)), model(), SLOT(parseCurrentFile()));
addAction(pCheckCurrentFile);
KAction *pActionShowErrors = new KAction(this);
addAction(pActionShowErrors);
pActionShowErrors->setCheckable(true);
pActionShowErrors->setChecked(false);
pActionShowErrors->setText(i18n("Show errors"));
pActionShowErrors->setToolTip(i18n("Show errors"));
pActionShowErrors->setIcon(KIcon("user-busy"));
model()->setShowErrors(true);
connect(pActionShowErrors, SIGNAL(triggered(bool)), model(), SLOT(setShowErrors(bool)));
KAction *pActionShowWarnings = new KAction(this);
addAction(pActionShowWarnings);
pActionShowWarnings->setCheckable(true);
pActionShowWarnings->setChecked(false);
pActionShowWarnings->setText(i18n("Show warnings"));
pActionShowWarnings->setToolTip(i18n("Show warnings"));
pActionShowWarnings->setIcon(KIcon("dialog-warning"));
model()->setShowWarnings(true);
connect(pActionShowWarnings, SIGNAL(triggered(bool)), model(), SLOT(setShowWarnings(bool)));
KAction *pActionShowStyle = new KAction(this);
addAction(pActionShowStyle);
pActionShowStyle->setCheckable(true);
pActionShowStyle->setChecked(false);
pActionShowStyle->setText(i18n("Show style warnings"));
pActionShowStyle->setToolTip(i18n("Show style warnings"));
pActionShowStyle->setIcon(KIcon("help-hint"));
model()->setShowStyle(true);
connect(pActionShowStyle, SIGNAL(triggered(bool)), model(), SLOT(setShowStyle(bool)));
KAction *pActionShowPortability = new KAction(this);
addAction(pActionShowPortability);
pActionShowPortability->setCheckable(true);
pActionShowPortability->setChecked(false);
pActionShowPortability->setText(i18n("Show portability warnings"));
pActionShowPortability->setToolTip(i18n("Show portability warnings"));
pActionShowPortability->setIcon(KIcon("office-chart-ring"));
model()->setShowPortability(true);
connect(pActionShowPortability, SIGNAL(triggered(bool)), model(), SLOT(setShowPortability(bool)));
KAction *pActionShowPerformance = new KAction(this);
addAction(pActionShowPerformance);
pActionShowPerformance->setCheckable(true);
pActionShowPerformance->setChecked(false);
pActionShowPerformance->setText(i18n("Show performance warnings"));
pActionShowPerformance->setToolTip(i18n("Show performance warnings"));
pActionShowPerformance->setIcon(KIcon("fork"));
model()->setShowPerformance(true);
connect(pActionShowPerformance, SIGNAL(triggered(bool)), model(), SLOT(setShowPerformance(bool)));
KAction *pActionShowInformation = new KAction(this);
addAction(pActionShowInformation);
pActionShowInformation->setCheckable(true);
pActionShowInformation->setChecked(false);
pActionShowInformation->setText(i18n("Show information messages"));
pActionShowInformation->setToolTip(i18n("Show information messages"));
pActionShowInformation->setIcon(KIcon("help-about"));
model()->setShowInformation(true);
connect(pActionShowInformation, SIGNAL(triggered(bool)), model(), SLOT(setShowInformation(bool)));
}