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


C++ KActionCollection类代码示例

本文整理汇总了C++中KActionCollection的典型用法代码示例。如果您正苦于以下问题:C++ KActionCollection类的具体用法?C++ KActionCollection怎么用?C++ KActionCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KActionCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: part

    void ScriptManager::setupActions()
    {
        KActionCollection* ac = part()->actionCollection();

        add_script = new QAction(QIcon::fromTheme("list-add"), i18n("Add Script"), this);
        connect(add_script, SIGNAL(triggered()), this, SIGNAL(addScript()));
        ac->addAction("add_script", add_script);

        remove_script = new QAction(QIcon::fromTheme("list-remove"), i18n("Remove Script"), this);
        connect(remove_script, SIGNAL(triggered()), this, SIGNAL(removeScript()));
        ac->addAction("remove_script", remove_script);

        run_script = new QAction(QIcon::fromTheme("system-run"), i18n("Run Script"), this);
        connect(run_script, SIGNAL(triggered()), this, SLOT(runScript()));
        ac->addAction("run_script", run_script);

        stop_script = new QAction(QIcon::fromTheme("media-playback-stop"), i18n("Stop Script"), this);
        connect(stop_script, SIGNAL(triggered()), this, SLOT(stopScript()));
        ac->addAction("stop_script", stop_script);

        edit_script = new QAction(QIcon::fromTheme("document-open"), i18n("Edit Script"), this);
        connect(edit_script, SIGNAL(triggered()), this, SLOT(editScript()));
        ac->addAction("edit_script", edit_script);

        properties = new QAction(QIcon::fromTheme("dialog-information"), i18n("Properties"), this);
        connect(properties, SIGNAL(triggered()), this, SLOT(showProperties()));
        ac->addAction("script_properties", properties);

        configure_script = new QAction(QIcon::fromTheme("preferences-other"), i18n("Configure"), this);
        connect(configure_script, SIGNAL(triggered()), this, SLOT(configureScript()));
        ac->addAction("configure_script", configure_script);
    }
开发者ID:biwin,项目名称:ktorrent,代码行数:32,代码来源:scriptmanager.cpp

示例2: QObject

KompareModelList::KompareModelList( DiffSettings* diffSettings, QWidget* widgetForKIO, QObject* parent, const char* name )
	: QObject( parent ),
	m_diffProcess( 0 ),
	m_diffSettings( diffSettings ),
	m_models( 0 ),
	m_selectedModel( 0 ),
	m_selectedDifference( 0 ),
	m_modelIndex( 0 ),
	m_info( 0 ),
	m_textCodec( 0 ),
	m_widgetForKIO( widgetForKIO )
{
	kDebug(8101) << "Show me the arguments: " << diffSettings << ", " << widgetForKIO << ", " << parent << ", " << name << endl;
	KActionCollection *ac = ((KomparePart*) parent)->actionCollection();
	m_applyDifference = ac->addAction( "difference_apply", this, SLOT(slotActionApplyDifference()) );
	m_applyDifference->setIcon( KIcon("arrow-right") );
	m_applyDifference->setText( i18n("&Apply Difference") );
	m_applyDifference->setShortcut( QKeySequence(Qt::Key_Space) );
	m_unApplyDifference = ac->addAction( "difference_unapply", this, SLOT(slotActionUnApplyDifference()) );
	m_unApplyDifference->setIcon( KIcon("arrow-left") );
	m_unApplyDifference->setText( i18n("Un&apply Difference") );
	m_unApplyDifference->setShortcut( QKeySequence(Qt::Key_Backspace) );
	m_applyAll = ac->addAction( "difference_applyall", this, SLOT(slotActionApplyAllDifferences()) );
	m_applyAll->setIcon( KIcon("arrow-right-double") );
	m_applyAll->setText( i18n("App&ly All") );
	m_applyAll->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_A) );
	m_unapplyAll = ac->addAction( "difference_unapplyall", this, SLOT(slotActionUnapplyAllDifferences()) );
	m_unapplyAll->setIcon( KIcon("arrow-left-double") );
	m_unapplyAll->setText( i18n("&Unapply All") );
	m_unapplyAll->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_U) );
	m_previousFile = ac->addAction( "difference_previousfile", this, SLOT(slotPreviousModel()) );
	m_previousFile->setIcon( KIcon("arrow-up-double") );
	m_previousFile->setText( i18n("P&revious File") );
	m_previousFile->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_PageUp) );
	m_nextFile = ac->addAction( "difference_nextfile", this, SLOT(slotNextModel()) );
	m_nextFile->setIcon( KIcon("arrow-down-double") );
	m_nextFile->setText( i18n("N&ext File") );
	m_nextFile->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_PageDown) );
	m_previousDifference = ac->addAction( "difference_previous", this, SLOT(slotPreviousDifference()) );
	m_previousDifference->setIcon( KIcon("arrow-up") );
	m_previousDifference->setText( i18n("&Previous Difference") );
	m_previousDifference->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_Up) );
	m_nextDifference = ac->addAction( "difference_next", this, SLOT(slotNextDifference()) );
	m_nextDifference->setIcon( KIcon("arrow-down") );
	m_nextDifference->setText( i18n("&Next Difference") );
	m_nextDifference->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_Down) );
	m_previousDifference->setEnabled( false );
	m_nextDifference->setEnabled( false );

	m_save = KStandardAction::save( this, SLOT(slotSaveDestination()), ac );
	m_save->setEnabled( false );

	updateModelListActions();
}
开发者ID:annulen,项目名称:kompare,代码行数:54,代码来源:komparemodellist.cpp

示例3: mGroupedViews

SwitchViewController::SwitchViewController( AbstractGroupedViews* groupedViews, KXMLGUIClient* guiClient )
   : mGroupedViews( groupedViews )
{
    KActionCollection* actionCollection = guiClient->actionCollection();

    mForwardAction = actionCollection->addAction( KStandardAction::Forward, QStringLiteral("window_next"), this, SLOT(forward()) );
    mBackwardAction = actionCollection->addAction( KStandardAction::Back, QStringLiteral("window_previous"), this, SLOT(backward()) );

    connect( groupedViews, SIGNAL(added(QList<Kasten::AbstractView*>)),  SLOT(updateActions()) );
    connect( groupedViews, SIGNAL(removing(QList<Kasten::AbstractView*>)), SLOT(updateActions()) );

    connect( groupedViews, SIGNAL(viewFocusChanged(Kasten::AbstractView*)), SLOT(updateActions()) );

    updateActions();
}
开发者ID:KDE,项目名称:okteta,代码行数:15,代码来源:switchviewcontroller.cpp

示例4: KisToolShape

KisToolPolylineBase::KisToolPolylineBase(KoCanvasBase * canvas,  KisToolPolylineBase::ToolType type, const QCursor & cursor)
    : KisToolShape(canvas, cursor),
      m_dragging(false),
      m_type(type),
      m_closeSnappingActivated(false)
{
    KisCanvas2 * kiscanvas = dynamic_cast<KisCanvas2*>(this->canvas());
    KActionCollection *collection = this->canvas()->canvasController()->actionCollection();
    if (kiscanvas && kiscanvas->viewManager()) {
        QAction *undo_polygon_selection = new QAction("Undo Polygon Selection Points",this);
        undo_polygon_selection->setShortcut(QKeySequence(Qt::ShiftModifier + Qt::Key_Z));
        collection->addAction("undo_polygon_selection", undo_polygon_selection);
        addAction("undo_polygon_selection", undo_polygon_selection);
    }
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:15,代码来源:kis_tool_polyline_base.cpp

示例5: KUrl

void KOEventPopupMenu::forward()
{
  KOrg::MainWindow *w = ActionManager::findInstance( KUrl() );
  if ( !w || !mCurrentIncidence ) {
    return;
  }

  KActionCollection *ac = w->getActionCollection();
  QAction *action = ac->action( "schedule_forward" );
  if ( action ) {
    action->trigger();
  } else {
    kError() << "What happened to the schedule_forward action?";
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:15,代码来源:koeventpopupmenu.cpp

示例6: configureToolbars

void ActionConfigDialog::slotEditToolbar()
{
  QString toolbarName;
  QString toolbarId;
  QListViewItem *oldItem;
  QListViewItem *item = actionTreeView->currentItem();
  if (item->parent())
     item = item->parent();
  toolbarName = item->text(0);
  if ( toolbarName != i18n("All"))
  {
    emit configureToolbars(toolbarName +" <quanta>");

    //update the tree view
    KAction *action;
    KActionCollection *ac = m_mainWindow->actionCollection();
    ToolbarTabWidget *tb = ToolbarTabWidget::ref();
    for (int i = 0; i < tb->count(); i++)
    {
      toolbarName = tb->label(i);
      toolbarId = tb->id(i);
      ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
      if (p_toolbar)
      {
        oldItem = actionTreeView->findItem(toolbarName, 0);
        item = new KListViewItem(actionTreeView, oldItem, toolbarName);
        item->setOpen(oldItem->isOpen());
        delete oldItem;
        QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
        while (!node.isNull())
        {
          if (node.nodeName() == "Action")
          {
            action = ac->action(node.toElement().attribute("name"));
            if (action)
            {
              oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name());
              oldItem->setPixmap(0, SmallIcon(action->icon()));
            }
          }
          node = node.nextSibling();
        }
      }
    }
    actionTreeView->setCurrentItem(allActionsItem);
    actionTreeView->setSelected(allActionsItem, true);
  }
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:48,代码来源:actionconfigdialog.cpp

示例7: SLOT

Tag::Tag()
{
    static int tagNumber = 0;
    ++tagNumber;
    QString sAction = "tag_shortcut_number_" + QString::number(tagNumber);

    KActionCollection *ac = Global::bnpView->actionCollection();
    m_action = ac->addAction(sAction, Global::bnpView,
                             SLOT(activatedTagShortcut()));
    m_action->setText("FAKE TEXT");
    m_action->setIcon(KIcon("FAKE ICON"));

    m_action->setShortcutConfigurable(false); // We do it in the tag properties dialog

    m_inheritedBySiblings = false;
}
开发者ID:tytycoon,项目名称:basket,代码行数:16,代码来源:tag.cpp

示例8: KActionCollection

MouseMarkEffect::MouseMarkEffect()
{
    KActionCollection* actionCollection = new KActionCollection(this);
    KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks"));
    a->setText(i18n("Clear All Mouse Marks"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
    a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));
    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    reconfigure(ReconfigureAll);
    arrow_start = NULL_POINT;
    effects->startMousePolling(); // We require it to detect activation as well
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:17,代码来源:mousemark.cpp

示例9: actionCollection

    void GUI::setupActions()
    {
        KActionCollection* ac = actionCollection();
        QAction * new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
        new_action->setToolTip(i18n("Create a new torrent"));
        QAction * open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
        open_action->setToolTip(i18n("Open a torrent"));
        paste_action = KStandardAction::paste(this, SLOT(paste()), ac);

        open_silently_action = new QAction(open_action->icon(), i18n("Open Silently"), this);
        open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
        connect(open_silently_action, &QAction::triggered, this, &GUI::openTorrentSilently);
        ac->addAction(QStringLiteral("file_open_silently"), open_silently_action);

        KStandardAction::quit(this, SLOT(quit()), ac);

        show_status_bar_action = KStandardAction::showStatusbar(statusBar(), SLOT(setVisible(bool)), ac);
        show_status_bar_action->setIcon(QIcon::fromTheme(QStringLiteral("kt-show-statusbar")));

        show_menu_bar_action = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), ac);
        KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
        KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
        KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
        KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);

        paste_url_action = new QAction(QIcon::fromTheme(QStringLiteral("document-open-remote")), i18n("Open URL"), this);
        paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
        connect(paste_url_action, &QAction::triggered, this, &GUI::pasteURL);
        ac->addAction(QStringLiteral("paste_url"), paste_url_action);
        ac->setDefaultShortcut(paste_url_action, QKeySequence(Qt::CTRL + Qt::Key_P));

        ipfilter_action = new QAction(QIcon::fromTheme(QStringLiteral("view-filter")), i18n("IP Filter"), this);
        ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
        connect(ipfilter_action, &QAction::triggered, this, &GUI::showIPFilter);
        ac->addAction(QStringLiteral("ipfilter_action"), ipfilter_action);
        ac->setDefaultShortcut(ipfilter_action, QKeySequence(Qt::CTRL + Qt::Key_I));

        import_action = new QAction(QIcon::fromTheme("document-import"), i18n("Import Torrent"), this);
        import_action->setToolTip(i18n("Import a torrent"));
        connect(import_action, &QAction::triggered, this, &GUI::import);
        ac->addAction(QStringLiteral("import"), import_action);
        ac->setDefaultShortcut(import_action, QKeySequence(Qt::SHIFT + Qt::Key_I));

        show_kt_action = new QAction(QIcon::fromTheme(QStringLiteral("kt-show-hide")), i18n("Show/Hide KTorrent"), this);
        connect(show_kt_action, &QAction::triggered, this, &GUI::showOrHide);
        ac->addAction(QStringLiteral("show_kt"), show_kt_action);
        // KF5 show_kt_action->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_T));

        setStandardToolBarMenuEnabled(true);
    }
开发者ID:biwin,项目名称:ktorrent,代码行数:50,代码来源:gui.cpp

示例10: mToolInlineViewable

// TODO: a tool(view) might perhaps be invoked indirectly by asking for a tool for the object, here select
// so the status bar selection indicator can invoke the same tool, without knowing about it
SelectRangeController::SelectRangeController( If::ToolInlineViewable* toolInlineViewable, KXMLGUIClient* guiClient )
  : mToolInlineViewable( toolInlineViewable )
{
    KActionCollection* actionCollection = guiClient->actionCollection();

    mSelectAction = actionCollection->addAction( QLatin1String("edit_select"),
                                                 this, SLOT(select()) );
    mSelectAction->setText( i18nc("@action:inmenu","&Select range...") );
    mSelectAction->setIcon( KIcon(QLatin1String("select-rectangular")) );
    mSelectAction->setShortcut( Qt::CTRL + Qt::Key_E );

    mTool = new SelectRangeTool();
    connect( mTool, SIGNAL(isUsableChanged(bool)),
             mSelectAction, SLOT(setEnabled(bool)) );
    mSelectAction->setEnabled( mTool->isUsable() );

    mView = new SelectRangeToolView( mTool );
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:20,代码来源:selectrangecontroller.cpp

示例11: actionCollection

void ActionManagerImpl::initArticleViewer(ArticleViewer* articleViewer)
{
    if (d->articleViewer)
        return;
    else
        d->articleViewer = articleViewer;

    KActionCollection* coll = actionCollection();
    KAction* action = 0;

    action = KStandardAction::print(articleViewer, SLOT(slotPrint()), actionCollection());
    coll->addAction("viewer_print", action);

    action = KStandardAction::copy(articleViewer, SLOT(slotCopy()), coll);
    coll->addAction("viewer_copy", action);

    connect(d->tabWidget, SIGNAL(signalZoomInFrame(int)), d->articleViewer, SLOT(slotZoomIn(int)));
    connect(d->tabWidget, SIGNAL(signalZoomOutFrame(int)), d->articleViewer, SLOT(slotZoomOut(int)));
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:19,代码来源:actionmanagerimpl.cpp

示例12: updateToggleActions

void TabBar::updateToggleActions(int sessionId)
{
    if (sessionId == -1) return;

    KActionCollection* actionCollection = m_mainWindow->actionCollection();
    SessionStack* sessionStack = m_mainWindow->sessionStack();

    QAction* toggleAction = actionCollection->action("toggle-session-prevent-closing");
    toggleAction->setChecked(!sessionStack->isSessionClosable(sessionId));

    toggleAction = actionCollection->action("toggle-session-keyboard-input");
    toggleAction->setChecked(!sessionStack->hasTerminalsWithKeyboardInputEnabled(sessionId));

    toggleAction = actionCollection->action("toggle-session-monitor-activity");
    toggleAction->setChecked(!sessionStack->hasTerminalsWithMonitorActivityDisabled(sessionId));

    toggleAction = actionCollection->action("toggle-session-monitor-silence");
    toggleAction->setChecked(!sessionStack->hasTerminalsWithMonitorSilenceDisabled(sessionId));
}
开发者ID:igordcard,项目名称:yakuake,代码行数:19,代码来源:tabbar.cpp

示例13: kdDebug

// private
void kpTool::createAction ()
{
#if DEBUG_KP_TOOL && 0
    kdDebug () << "kpTool(" << name () << "::createAction()" << endl;
#endif

    if (!m_mainWindow)
    {
        kdError () << "kpTool::createAction() without mw" << endl;
        return;
    }

    KActionCollection *ac = m_mainWindow->actionCollection ();
    if (!ac)
    {
        kdError () << "kpTool::createAction() without ac" << endl;
        return;
    }


    if (m_action)
    {
        // TODO: I don't think this will ever be executed as we are not called
        //       outside of the constructor.
    #if DEBUG_KP_TOOL
        kdDebug () << "\tdeleting existing" << endl;
    #endif
        ac->remove (m_action);
        m_action = 0;
    }


    m_action = new kpToolAction (text (), iconName (), shortcutForKey (m_key),
                                 this, SLOT (slotActionActivated ()),
                                 m_mainWindow->actionCollection (), name ());
    m_action->setExclusiveGroup (QString::fromLatin1 ("Tool Box Actions"));
    m_action->setWhatsThis (description ());

    connect (m_action, SIGNAL (toolTipChanged (const QString &)),
             this, SLOT (slotActionToolTipChanged (const QString &)));
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:42,代码来源:kptool.cpp

示例14: KActionCollection

MouseMarkEffect::MouseMarkEffect()
{
    KActionCollection* actionCollection = new KActionCollection(this);
    QAction* a = actionCollection->addAction(QStringLiteral("ClearMouseMarks"));
    a->setText(i18n("Clear All Mouse Marks"));
    KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
    KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
    a = actionCollection->addAction(QStringLiteral("ClearLastMouseMark"));
    a->setText(i18n("Clear Last Mouse Mark"));
    KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
    KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));

    connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
            this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
    connect(effects, SIGNAL(screenLockingChanged(bool)), SLOT(screenLockingChanged(bool)));
    reconfigure(ReconfigureAll);
    arrow_start = NULL_POINT;
    effects->startMousePolling(); // We require it to detect activation as well
}
开发者ID:aarontc,项目名称:kde-workspace,代码行数:21,代码来源:mousemark.cpp

示例15: if

void RubyDebuggerPart::slotStatus(const QString &msg, int state)
{
    QString stateIndicator;

    if (state & s_dbgNotStarted)
    {
        stateIndicator = " ";
    }
    else if (state & s_appBusy)
    {
        stateIndicator = "A";
        debugger()->clearExecutionPoint();
        stateChanged( QString("active") );
    }
    else if (state & s_programExited)
    {
        stateIndicator = "E";
        stateChanged( QString("stopped") );
        KActionCollection *ac = actionCollection();
        ac->action("debug_run")->setText( i18n("Restart") );
//        ac->action("debug_run")->setIcon( "1rightarrow" );
        ac->action("debug_run")->setToolTip( i18n("Restart the program in the debugger") );
        ac->action("debug_run")->setWhatsThis( i18n("Restart in debugger\n\n"
                                               "Restarts the program in the debugger") );
//        slotStop();
    }
    else
    {
        stateIndicator = "P";
        stateChanged( QString("paused") );
    }

    // And now? :-)
    kdDebug(9012) << "Debugger state: " << stateIndicator << ": " << endl;
    kdDebug(9012) << "   " << msg << endl;

    statusBarIndicator->setText(stateIndicator);
    if (!msg.isEmpty())
        mainWindow()->statusBar()->message(msg, 3000);
}
开发者ID:,项目名称:,代码行数:40,代码来源:


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