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


C++ KAction类代码示例

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


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

示例1: KToolBar

SearchToolBar::SearchToolBar(KMainWindow* parent, QObject* receiver, const char* slot, const char* name)
    : KToolBar(parent, DockTop, false, name, true)
{
    // support for clearing the search
    KAction *clearAction = new KAction(i18n("Clear"), QString::fromLatin1("locationbar_erase"), 0,
                                       this, SLOT(clear()), new KActionCollection(this),
                                       "clear" );
    clearAction->plug(this);

    // display label
    QLabel* label = new QLabel(i18n("Search:") + QString::fromLatin1(" "), this);
    insertWidget(-1, -1, label);

    // the editable combo box
    m_combo = new KComboBox(this);
    m_combo->setEditable(true);
    m_combo->setInsertionPolicy(QComboBox::AtTop);
    insertWidget(-1, -1, m_combo);
    connect(m_combo, SIGNAL(activated(const QString& )),
            this, SIGNAL(find(const QString& )));
    connect(m_combo, SIGNAL(returnPressed()),
            m_combo->lineEdit(), SLOT(selectAll()));
    setStretchableWidget(m_combo);
    m_combo->setFocus();
    QWhatsThis::add( m_combo, i18n( "Enter word to conjugate here" ) );

    // extra, a button to do the search
    KAction *findAction = new KAction(i18n("Find"), QString::fromLatin1("find"), 0,
                                      this, SLOT( find() ), new KActionCollection(this),
                                      "find");
    findAction->plug(this);

    // connect the arguments
    connect(this, SIGNAL(find(const QString& )), receiver, slot);
}
开发者ID:corentin38,项目名称:konjue,代码行数:35,代码来源:searchtoolbar.cpp

示例2: QL1S

void TabBar::setupHistoryActions()
{
    MainWindow *w = Application::instance()->mainWindow();
    MainView *mv = qobject_cast<MainView *>(parent());

    QAction *openLastClosedTabAction = w->actionByName( QL1S("open_last_closed_tab") );
    openLastClosedTabAction->setEnabled( mv->recentlyClosedTabs().size() > 0 );

    // update closed tabs menu
    KActionMenu *am = qobject_cast<KActionMenu *>( w->actionByName( QL1S("closed_tab_menu") ));
    if (!am)
        return;

    bool isEnabled = ( mv->recentlyClosedTabs().size() > 0 );
    am->setEnabled(isEnabled);

    if (am->menu())
        am->menu()->clear();

    if(!isEnabled)
        return;

    Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs())
    {
        KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this);
        a->setData(item.url);
        connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
        am->addAction(a);
    }
}
开发者ID:Fxrh,项目名称:rekonq,代码行数:30,代码来源:tabbar.cpp

示例3: kdDebug

KActionMenu* WPAccount::actionMenu()
{
	kdDebug(14170) <<  "WPAccount::actionMenu()" << endl;

	/// How to remove an action from Kopete::Account::actionMenu()? GF

	KActionMenu *theActionMenu = new KActionMenu(accountId() , myself()->onlineStatus().iconFor(this), this);
	theActionMenu->popupMenu()->insertTitle(myself()->onlineStatus().iconFor(this), i18n("WinPopup (%1)").arg(accountId()));

	if (mProtocol)
	{
		KAction *goOnline = new KAction("Online", QIconSet(mProtocol->WPOnline.iconFor(this)), 0,
										 this, SLOT(connect()), theActionMenu, "actionGoAvailable");
		goOnline->setEnabled(isConnected() && isAway());
		theActionMenu->insert(goOnline);

		KAction *goAway = new KAction("Away", QIconSet(mProtocol->WPAway.iconFor(this)), 0,
									  this, SLOT(goAway()), theActionMenu, "actionGoAway");
		goAway->setEnabled(isConnected() && !isAway());
		theActionMenu->insert(goAway);

		/// One can not really go offline manually - appears online as long as samba server is running. GF

		theActionMenu->popupMenu()->insertSeparator();
		theActionMenu->insert(new KAction(i18n("Properties"),  0,
							  this, SLOT(editAccount()), theActionMenu, "actionAccountProperties"));

	}

	return theActionMenu;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:31,代码来源:wpaccount.cpp

示例4: SLOT

void MainWindow::setupActions()
{
    actQuit         = KStandardAction::quit(this, SLOT(quit()), actionCollection());
    KAction *a = NULL;
    a = actionCollection()->addAction("minimizeRestore", this,
                                      SLOT(minimizeRestore()));
    a->setText(i18n("Minimize"));
    a->setIcon(KIcon(""));
    a->setShortcut(0);

    /** Settings : ************************************************************/
//  m_actShowToolbar   = KStandardAction::showToolbar(   this, SLOT(toggleToolBar()),   actionCollection());
    m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection());

//  m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) );

    (void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection());

    (void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

    //KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() );
    //actCfgNotifs->setEnabled(false); // Not yet implemented !

    actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection());
}
开发者ID:daviddamerell,项目名称:basket,代码行数:25,代码来源:mainwindow.cpp

示例5: KexiView

KexiReportDesignView::KexiReportDesignView(QWidget *parent, ReportEntitySelector* r)
        : KexiView(parent)
{
    scr = new QScrollArea(this);
    layout()->addWidget(scr);
    res = r;
    _rd = 0;

    editCutAction = new KAction(KIcon("edit-cut"), i18n("Cut"), this);
    editCutAction->setObjectName("editcut");
    editCopyAction = new KAction(KIcon("edit-copy"), i18n("Copy"), this);
    editCopyAction->setObjectName("editcopy");
    editPasteAction = new KAction(KIcon("edit-paste"), i18n("Paste"), this);
    editPasteAction->setObjectName("editpaste");
    editDeleteAction = new KAction(KIcon("edit-delete"), i18n("Delete"), this);
    editDeleteAction->setObjectName("editdelete");

    sectionEdit = new KAction(i18n("Section Editor"), this);
    sectionEdit->setObjectName("sectionedit");

    itemRaiseAction = new KAction(KIcon("arrow-up"), i18n("Raise"), this);
    itemRaiseAction->setObjectName("itemraise");
    itemLowerAction = new KAction(KIcon("arrow-down"), i18n("Lower"), this);
    itemLowerAction->setObjectName("itemlower");
    //parameterEdit = new KAction ( i18n ( "Parameter Editor" ), this );
    //parameterEdit->setObjectName("parameteredit");
    QList<QAction*> al;
    KAction *sep = new KAction("", this);
    sep->setSeparator(true);

    al << editCutAction << editCopyAction << editPasteAction << editDeleteAction << sep << sectionEdit << sep << itemLowerAction << itemRaiseAction;
    setViewActions(al);

}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:34,代码来源:kexireportdesignview.cpp

示例6: KUniqueApplication

App::App() : KUniqueApplication()
    ,m_networkAccessManager(new NetworkAccessManager(this))
    ,m_oauth(new QOAuth::Interface(this))
    ,m_parser(new QJson::Parser)
    ,m_mainWindow(0)
    ,m_controller(0)
    ,m_tray(0)
{
    qmlRegisterType<QDeclarativePropertyMap>();

    m_controller = new Controller;
    m_mainWindow = new MainWindow;
    m_tray = new KStatusNotifierItem(m_mainWindow);
    m_tray->setIconByName("kmoefm");
    m_tray->setTitle(i18n("Moe FM"));
    m_tray->setToolTipIconByName("kmoefm");
    m_tray->setToolTipTitle(i18n("KMoeFM"));
    m_tray->setToolTipSubTitle(i18n("Moe FM"));
    KAction* action;
    action = m_tray->actionCollection()->addAction(QLatin1String("relogin"), this, SLOT(relogin()));
    action->setText(i18n("Relogin"));
    m_tray->contextMenu()->addAction(action);
    m_tray->setAssociatedWidget(m_mainWindow);

    connect(m_controller, SIGNAL(infoChanged()), this, SLOT(updateInfo()));

    m_oauth->setConsumerKey(CONSUMER_KEY);
    m_oauth->setConsumerSecret(CONSUMER_SECRET);

    readSettings();

    connect(this, SIGNAL(checkCredentialFinished(bool)), SLOT(firstRunCheck(bool)));
    QTimer::singleShot(0, this, SLOT(checkCredential()));
}
开发者ID:wengxt,项目名称:kmoefm,代码行数:34,代码来源:app.cpp

示例7: unplugActionList

void KNotesApp::updateNoteActions()
{
    unplugActionList( "notes" );
    m_noteActions.clear();

    for ( QDictIterator<KNote> it( m_noteList ); it.current(); ++it )
    {
        KAction *action = new KAction( it.current()->name().replace("&", "&&"),
                                       KShortcut(), this, SLOT(slotShowNote()),
                                       (QObject *)0,
                                       it.current()->noteId().utf8() );
        KIconEffect effect;
        QPixmap icon = effect.apply( kapp->miniIcon(), KIconEffect::Colorize, 1,
                                     it.current()->paletteBackgroundColor(), false );
        action->setIconSet( icon );
        m_noteActions.append( action );
    }

    m_noteActions.sort();

    if ( m_noteActions.isEmpty() )
    {
        KAction *action = new KAction( i18n("No Notes") );
        m_noteActions.append( action );
    }

    plugActionList( "notes", m_noteActions );
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例8: KDevMakeFrontend

MakeViewPart::MakeViewPart(QObject *parent, const char *name, const QStringList &)
    : KDevMakeFrontend(&data, parent, name)
{
    setInstance(MakeViewFactory::instance());

    setXMLFile("kdevmakeview.rc");

    m_dcop = new KDevMakeFrontendIface(this);

    m_widget = new MakeWidget(this);
    m_widget->setIcon( SmallIcon("exec") );
    m_widget->setCaption(i18n("Messages Output"));
    QWhatsThis::add(m_widget, i18n("<b>Messages output</b><p>"
                                   "The messages window shows the output of the compiler and "
                                   "used build tools like make, ant, uic, dcopidl etc. "
                                   "For compiler error messages, click on the error message. "
                                   "This will automatically open the source file and set the "
                                   "cursor to the line that caused the compiler error/warning."));

    mainWindow()->embedOutputView(m_widget, i18n("Messages"), i18n("Compiler output messages"));

    KAction *action;
    action = new KAction( i18n("&Next Error"), Key_F4, m_widget, SLOT(nextError()),
                          actionCollection(), "view_next_error");
    action->setToolTip( i18n("Go to the next error") );
    action->setWhatsThis(i18n("<b>Next error</b><p>Switches to the file and line where the next error was reported from."));
    action = new KAction( i18n("&Previous Error"), SHIFT+Key_F4, m_widget, SLOT(prevError()),
                          actionCollection(), "view_previous_error");
    action->setToolTip( i18n("Go to the previous error") );
    action->setWhatsThis(i18n("<b>Previous error</b><p>Switches to the file and line where the previous error was reported from."));

    connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
             this, SLOT(slotStopButtonClicked(KDevPlugin*)) );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:34,代码来源:makeviewpart.cpp

示例9: setupShourtcutTips

void Core::setupShourtcutTips(KXMLGUIClient * client)
{
  QPtrList<KXMLGUIClient> clients;
  if (client != 0)
    clients.append(client);
  else
    clients = TopLevel::getInstance()->main()->guiFactory()->clients();
  
  for( QPtrListIterator<KXMLGUIClient> it(clients); it.current(); ++it ) {
    KActionCollection *actionCollection = (*it)->actionCollection();
    for (int i = 0; i < actionCollection->count(); i++) {
      KAction *action = actionCollection->action(i);
            
      QString tooltip = action->toolTip();
      if (tooltip.isEmpty())
        tooltip = action->text().remove('&');
      else {
        int i = tooltip.findRev('(');
        if (i > 0) tooltip = tooltip.left(i).stripWhiteSpace();
      }

      QString shortcut = action->shortcutText();
      if (!shortcut.isEmpty())
        tooltip += " (" + shortcut + ")";
        action->setToolTip(tooltip);
      }
  }
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:28,代码来源:core.cpp

示例10: KActionCollection

void K3bVideoDVDRippingView::initActions()
{
  m_actionCollection = new KActionCollection( this );

  KAction* actionSelectAll = new KAction( i18n("Check All"), 0, 0, this,
					  SLOT(slotCheckAll()), actionCollection(),
					  "check_all" );
  KAction* actionDeselectAll = new KAction( i18n("Uncheck All"), 0, 0, this,
					    SLOT(slotUncheckAll()), actionCollection(),
					    "uncheck_all" );
  KAction* actionSelect = new KAction( i18n("Check Track"), 0, 0, this,
				       SLOT(slotCheck()), actionCollection(),
				       "select_track" );
  KAction* actionDeselect = new KAction( i18n("Uncheck Track"), 0, 0, this,
					 SLOT(slotUncheck()), actionCollection(),
					 "deselect_track" );
  KAction* actionStartRip = new KAction( i18n("Start Ripping"), "gear", 0, this,
					 SLOT(slotStartRipping()), m_actionCollection, "start_rip" );

  actionStartRip->setToolTip( i18n("Open the Video DVD ripping dialog") );

  // setup the popup menu
  m_popupMenu = new KActionMenu( actionCollection(), "popup_menu" );
  KAction* separator = new KActionSeparator( actionCollection(), "separator" );
  m_popupMenu->insert( actionSelect );
  m_popupMenu->insert( actionDeselect );
  m_popupMenu->insert( actionSelectAll );
  m_popupMenu->insert( actionDeselectAll );
  m_popupMenu->insert( separator );
  m_popupMenu->insert( actionStartRip );
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例11: KToolBarPopupAction

void ActionManagerImpl::initFrameManager(FrameManager* frameManager)
{
    if (d->frameManager)
        return;

    d->frameManager = frameManager;

    bool isRTL = QApplication::isRightToLeft();

    KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon(isRTL ? "go-previous" : "go-next"), i18nc("Go forward in browser history", "Forward"), this);
    d->actionCollection->addAction("browser_forward", forward);
    forward->setShortcuts(KShortcut(isRTL ? "Alt+Left" : "Alt+Right"));
    connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward()));

    connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow()));

    KToolBarPopupAction* back = new KToolBarPopupAction(KIcon(isRTL ? "go-next" : "go-previous"), i18nc("Go back in browser history", "Back"), this);
    d->actionCollection->addAction("browser_back", back);
    back->setShortcuts(KShortcut(isRTL ?  "Alt+Right" : "Alt+Left"));
    connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack()));

    connect(back->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserBackAboutToShow()));

    KAction *action = d->actionCollection->addAction("browser_reload");
    action->setIcon(KIcon("view-refresh"));
    action->setText(i18nc("Reload current page", "Reload"));
    connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserReload()));

    action = d->actionCollection->addAction("browser_stop");
    action->setIcon(KIcon("process-stop"));
    action->setText(i18n("Stop"));
    connect(action, SIGNAL(triggered(bool)), frameManager, SLOT(slotBrowserStop()));
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:33,代码来源:actionmanagerimpl.cpp

示例12: KSystemTray

amaroK::TrayIcon::TrayIcon( QWidget *playerWidget )
        : KSystemTray( playerWidget )
        , EngineObserver( EngineController::instance() )
        , trackLength( 0 )
        , mergeLevel( -1 )
        , overlay( 0 )
        , blinkTimerID( 0 )
        , overlayVisible( false )
{
    KActionCollection* const ac = amaroK::actionCollection();

    setAcceptDrops( true );

    ac->action( "prev"        )->plug( contextMenu() );
    ac->action( "play_pause"  )->plug( contextMenu() );
    ac->action( "stop"        )->plug( contextMenu() );
    ac->action( "next"        )->plug( contextMenu() );

    //seems to be necessary
    KAction *quit = actionCollection()->action( "file_quit" );
    quit->disconnect();
    connect( quit, SIGNAL(activated()), kapp, SLOT(quit()) );

    baseIcon     = KSystemTray::loadIcon( "amarok" );
    playOverlay  = amaroK::loadOverlay( "play" );
    pauseOverlay = amaroK::loadOverlay( "pause" );
    overlayVisible = false;

    //paintIcon();
    setPixmap( baseIcon );
}
开发者ID:tmarques,项目名称:waheela,代码行数:31,代码来源:systray.cpp

示例13: reconfigure

WindowGeometry::WindowGeometry()
{
    iAmActivated = true;
    iAmActive = false;
    myResizeWindow = 0L;
#define myResizeString "Window geometry display, %1 and %2 are the new size," \
                       " %3 and %4 are pixel increments - avoid reformatting or suffixes like 'px'", \
                       "Width: %1 (%3)\nHeight: %2 (%4)"
#define myCoordString_0 "Window geometry display, %1 and %2 are the cartesian x and y coordinates" \
                        " - avoid reformatting or suffixes like 'px'", \
                        "X: %1\nY: %2"
#define myCoordString_1 "Window geometry display, %1 and %2 are the cartesian x and y coordinates," \
                        " %3 and %4 are the resp. increments - avoid reformatting or suffixes like 'px'", \
                        "X: %1 (%3)\nY: %2 (%4)"
    reconfigure(ReconfigureAll);
    QFont fnt; fnt.setBold(true); fnt.setPointSize(12);
    for (int i = 0; i < 3; ++i) {
        myMeasure[i] = effects->effectFrame(EffectFrameUnstyled, false);
        myMeasure[i]->setFont(fnt);
    }
    myMeasure[0]->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    myMeasure[1]->setAlignment(Qt::AlignCenter);
    myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom);

    KActionCollection* actionCollection = new KActionCollection(this);
    KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry"));
    a->setText(i18n("Toggle window geometry display (effect only)"));
    a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
    connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
    connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*)));
    connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));
    connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect)));
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:33,代码来源:windowgeometry.cpp

示例14: KActionMenu

KActionMenu *TabBar::setupHistoryActions()
{
    MainWindow *w = rApp->mainWindow();
    MainView *mv = qobject_cast<MainView *>(parent());

    QAction *openLastClosedTabAction = w->actionByName(QL1S("open_last_closed_tab"));

    bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0);
    openLastClosedTabAction->setEnabled(closedTabsAvailable);

    KActionMenu *am = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
    am->setDelayed(false);
    am->setEnabled(closedTabsAvailable);

    if (am->menu())
        am->menu()->clear();

    if (!closedTabsAvailable)
        return am;

    for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i)
    {
        TabHistory item = mv->recentlyClosedTabs().at(i);
        KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this);
        a->setData(i);
        connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
        am->addAction(a);
    }

    return am;
}
开发者ID:Arakmar,项目名称:rekonq,代码行数:31,代码来源:tabbar.cpp

示例15: KAction

void FileBrowserWidget::setupToolbar()
{
	KActionCollection *coll = m_dirOperator->actionCollection();
	m_toolbar->addAction(coll->action("back"));
	m_toolbar->addAction(coll->action("forward"));

	KAction *action = new KAction(this);
	action->setIcon(SmallIcon("document-open"));
	action->setText(i18n("Open selected"));
	connect(action, SIGNAL(triggered()), this, SLOT(emitFileSelectedSignal()));
	m_toolbar->addAction(action);


	// section for settings menu
	KActionMenu *optionsMenu = new KActionMenu(KIcon("configure"), i18n("Options"), this);
	optionsMenu->setDelayed(false);
	optionsMenu->addAction(m_dirOperator->actionCollection()->action("short view"));
	optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed view"));
	optionsMenu->addAction(m_dirOperator->actionCollection()->action("tree view"));
	optionsMenu->addAction(m_dirOperator->actionCollection()->action("detailed tree view"));
	optionsMenu->addSeparator();
	optionsMenu->addAction(m_dirOperator->actionCollection()->action("show hidden"));

	m_toolbar->addSeparator();
	m_toolbar->addAction(optionsMenu);
}
开发者ID:fagu,项目名称:kileip,代码行数:26,代码来源:filebrowserwidget.cpp


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