当前位置: 首页>>代码示例>>C++>>正文


C++ KAction::setShortcutContext方法代码示例

本文整理汇总了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()));
}
开发者ID:portaloffreedom,项目名称:kdev-golang-plugin,代码行数:21,代码来源:filemanager.cpp

示例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)));
}
开发者ID:belkiss,项目名称:kdevcppcheck,代码行数:81,代码来源:ccppcheckwidget.cpp


注:本文中的KAction::setShortcutContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。