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


C++ KToggleAction::setText方法代码示例

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


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

示例1: addActionCloneToCollection

void MainWindow::addActionCloneToCollection(const QString &actionName, QAction *action)
{
	// XXX This is a dirty hack to avoid the warning "Attempt to use QAction with KXMLGUIFactory"
	KToggleAction *actionClone = new KToggleAction(this);
	actionCollection()->addAction(actionName, actionClone);
	actionClone->setText(action->text());
	actionClone->setIcon(action->icon());
	connect(action, SIGNAL(toggled(bool)), actionClone, SLOT(setChecked(bool)));
	connect(actionClone, SIGNAL(triggered()), action, SLOT(trigger()));
}
开发者ID:jfmcarreira,项目名称:ktikz,代码行数:10,代码来源:mainwindow.cpp

示例2: repopulateFOV

void KStars::repopulateFOV() {
    // Read list of all FOVs
    qDeleteAll( data()->availFOVs );
    data()->availFOVs = FOV::readFOVs();
    data()->syncFOV();

    // Iterate through FOVs
    fovActionMenu->menu()->clear();
    foreach(FOV* fov, data()->availFOVs) {
        KToggleAction *kta = actionCollection()->add<KToggleAction>( fov->name() );
        kta->setText( fov->name() );
        if( Options::fOVNames().contains( fov->name() ) ) {
            kta->setChecked(true);
        }
        fovActionMenu->addAction( kta );
        connect( kta, SIGNAL( toggled( bool ) ), this, SLOT( slotTargetSymbol(bool) ) );
    }
开发者ID:birefringence,项目名称:kstars,代码行数:17,代码来源:kstarsinit.cpp

示例3: KToggleAction

KToggleAction* K3b::createToggleAction( QObject* parent,
                                        const QString& text, const QString& icon, const
                                        QKeySequence& shortcut, QObject* receiver, const char* slot,
                                        KActionCollection* actionCollection,
                                        const QString& actionName )
{
    KToggleAction* action = new KToggleAction( parent );
    action->setText( text );
    if( !icon.isEmpty() ) {
        action->setIcon( QIcon::fromTheme( icon ) );
    }
    action->setShortcut( shortcut );
    if( receiver ) {
        QObject::connect( action, SIGNAL(triggered(bool)),
                          receiver, slot );
    }
    if( actionCollection ) {
        actionCollection->addAction( actionName, action );
    }
    return action;
}
开发者ID:KDE,项目名称:k3b,代码行数:21,代码来源:k3baction.cpp

示例4: createMenuActions

/**
 * Creates the right-click menu
 */
void KMixDockWidget::createMenuActions()
{
    QMenu *menu = contextMenu();
    if (!menu)
        return; // We do not use a menu

    shared_ptr<MixDevice> md = Mixer::getGlobalMasterMD();
    if ( md.get() != 0 && md->hasMuteSwitch() ) {
        // Put "Mute" selector in context menu
#ifdef X_KMIX_KF5_BUILD
        KToggleAction *action = new KToggleAction(i18n("M&ute"), this);
        action->setData("dock_mute");
        addAction("dock_mute", action);
#else
    	KToggleAction *action = actionCollection()->add<KToggleAction>( "dock_mute" );
        action->setText( i18n("M&ute") );
#endif
    	updateDockMuteAction(action);
        connect(action, SIGNAL(triggered(bool)), SLOT(dockMute()));
        menu->addAction( action );
    }

    // Put "Select Master Channel" dialog in context menu
#ifdef X_KMIX_KF5_BUILD
    QAction *action = new QAction(i18n("Select Master Channel..."), this);
    action->setData("select_master");
    addAction("select_master", action);
#else
    QAction *action = actionCollection()->addAction( "select_master" );
    action->setText( i18n("Select Master Channel...") );
#endif
    action->setEnabled(Mixer::getGlobalMasterMixer() != 0);
    connect(action, SIGNAL(triggered(bool)), _kmixMainWindow, SLOT(slotSelectMaster()));
    menu->addAction( action );

    //Context menu entry to access phonon settings
    menu->addAction(_kmixMainWindow->actionCollection()->action("launch_kdesoundsetup"));
}
开发者ID:KDE,项目名称:kmix,代码行数:41,代码来源:kmixdockwidget.cpp

示例5: initToolBars

void InlineEditors::initToolBars(KActionCollection *ac)
{
    QFont defaultFont;
    QColor textColor = (Global::bnpView && Global::bnpView->currentBasket() ?
                        Global::bnpView->currentBasket()->textColor() :
                        palette().color(QPalette::Text));

    // Init the RichTextEditor Toolbar:
    richTextFont = new QFontComboBox(Global::mainWindow());
    focusWidgetFilter = new FocusWidgetFilter(richTextFont);
    richTextFont->setFixedWidth(richTextFont->sizeHint().width() * 2 / 3);
    richTextFont->setCurrentFont(defaultFont.family());

    KAction *action = ac->addAction("richtext_font");
    action->setDefaultWidget(richTextFont);
    action->setText(i18n("Font"));
    action->setShortcut(Qt::Key_F6);

    richTextFontSize = new FontSizeCombo(/*rw=*/true, Global::mainWindow());
    richTextFontSize->setFontSize(defaultFont.pointSize());
    action = ac->addAction("richtext_font_size");
    action->setDefaultWidget(richTextFontSize);
    action->setText(i18n("Font Size"));
    action->setShortcut(Qt::Key_F7);

    richTextColor = new KColorCombo(Global::mainWindow());
    richTextColor->installEventFilter(focusWidgetFilter);
    richTextColor->setFixedWidth(richTextColor->sizeHint().height() * 2);
    richTextColor->setColor(textColor);
    action = ac->addAction("richtext_color");
    action->setDefaultWidget(richTextColor);
    action->setText(i18n("Color"));

    KToggleAction *ta = NULL;
    ta = new KToggleAction(ac);
    ac->addAction("richtext_bold", ta);
    ta->setText(i18n("Bold"));
    ta->setIcon(KIcon("format-text-bold"));
    ta->setShortcut(KShortcut("Ctrl+B"));
    richTextBold = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_italic", ta);
    ta->setText(i18n("Italic"));
    ta->setIcon(KIcon("format-text-italic"));
    ta->setShortcut(KShortcut("Ctrl+I"));
    richTextItalic = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_underline", ta);
    ta->setText(i18n("Underline"));
    ta->setIcon(KIcon("format-text-underline"));
    ta->setShortcut(KShortcut("Ctrl+U"));
    richTextUnderline = ta;

#if 0
    ta = new KToggleAction(ac);
    ac->addAction("richtext_super", ta);
    ta->setText(i18n("Superscript"));
    ta->setIcon(KIcon("text_super"));
    richTextSuper = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_sub", ta);
    ta->setText(i18n("Subscript"));
    ta->setIcon(KIcon("text_sub"));
    richTextSub = ta;
#endif

    ta = new KToggleAction(ac);
    ac->addAction("richtext_left", ta);
    ta->setText(i18n("Align Left"));
    ta->setIcon(KIcon("format-justify-left"));
    richTextLeft = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_center", ta);
    ta->setText(i18n("Centered"));
    ta->setIcon(KIcon("format-justify-center"));
    richTextCenter = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_right", ta);
    ta->setText(i18n("Align Right"));
    ta->setIcon(KIcon("format-justify-right"));
    richTextRight = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_block", ta);
    ta->setText(i18n("Justified"));
    ta->setIcon(KIcon("format-justify-fill"));
    richTextJustified = ta;

    QActionGroup *alignmentGroup = new QActionGroup(this);
    alignmentGroup->addAction(richTextLeft);
    alignmentGroup->addAction(richTextCenter);
    alignmentGroup->addAction(richTextRight);
    alignmentGroup->addAction(richTextJustified);

    ta = new KToggleAction(ac);
//.........这里部分代码省略.........
开发者ID:tosky,项目名称:basket,代码行数:101,代码来源:noteedit.cpp

示例6: initMainWidget

void ActionManagerImpl::initMainWidget(MainWidget* mainWidget)
{
    if (d->mainWidget)
        return;

    d->mainWidget = mainWidget;

    KActionCollection* coll = actionCollection();

    // Feed/Feed Group popup menu
    KAction* action = coll->addAction("feed_homepage");
    action->setText(i18n("&Open Homepage"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenHomepage()));
    action->setShortcuts(KShortcut( "Ctrl+H" ));

    action = coll->addAction("reload_all_tabs");
    action->setIcon(KIcon("view-refresh"));
    action->setText(i18n("Reload All Tabs"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotReloadAllTabs()));
    action->setShortcuts(KShortcut( "Shift+F5" ));


    action = coll->addAction("feed_add");
    action->setIcon(KIcon("feed-subscribe"));
    action->setText(i18n("&Add Feed..."));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAdd()));
    action->setShortcuts(KShortcut( "Insert" ));

    action = coll->addAction("feed_add_group");
    action->setIcon(KIcon("folder-new"));
    action->setText(i18n("Ne&w Folder..."));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAddGroup()));
    action->setShortcuts(KShortcut( "Shift+Insert" ));

    action = coll->addAction("feed_remove");
    action->setIcon(KIcon("edit-delete"));
    action->setText(i18n("&Delete Feed"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedRemove()));
    action->setShortcuts(KShortcut( "Alt+Delete" ));

    action = coll->addAction("feed_modify");
    action->setIcon(KIcon("document-properties"));
    action->setText(i18n("&Edit Feed..."));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedModify()));
    action->setShortcuts(KShortcut( "F2" ));

    // toolbar / View
    action = coll->addAction("normal_view");
    action->setIcon(KIcon("view-split-top-bottom"));
    action->setText(i18n("&Normal View"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNormalView()));
    action->setShortcuts(KShortcut( "Ctrl+Shift+1" ));

    action = coll->addAction("widescreen_view");
    action->setIcon(KIcon("view-split-left-right"));
    action->setText(i18n("&Widescreen View"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotWidescreenView()));
    action->setShortcuts(KShortcut( "Ctrl+Shift+2" ));

    action = coll->addAction("combined_view");
    action->setIcon(KIcon("view-list-text"));
    action->setText(i18n("C&ombined View"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCombinedView()));
    action->setShortcuts(KShortcut( "Ctrl+Shift+3" ));

    // toolbar / feed menu
    action = coll->addAction("feed_fetch");
    action->setIcon(KIcon("go-down"));
    action->setText(i18n("&Fetch Feed"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchCurrentFeed()));
    action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload));

    action = coll->addAction("feed_fetch_all");
    action->setIcon(KIcon("go-bottom"));
    action->setText(i18n("Fe&tch All Feeds"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchAllFeeds()));
    action->setShortcuts(KShortcut( "Ctrl+L" ));

    KAction *stopAction = coll->addAction("feed_stop");
    stopAction->setIcon(KIcon("process-stop"));
    stopAction->setText(i18n("C&ancel Feed Fetches"));
    connect(stopAction, SIGNAL(triggered(bool)), Kernel::self()->fetchQueue(), SLOT(slotAbort()));
    stopAction->setShortcut(QKeySequence(Qt::Key_Escape));
    stopAction->setEnabled(false);

    action = coll->addAction("feed_mark_all_as_read");
    action->setIcon(KIcon("mail-mark-read"));
    action->setText(i18n("&Mark Feed as Read"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllRead()));
    action->setShortcuts(KShortcut( "Ctrl+R" ));

    action = coll->addAction("feed_mark_all_feeds_as_read");
    action->setIcon(KIcon("mail-mark-read"));
    action->setText(i18n("Ma&rk All Feeds as Read"));
    connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllFeedsRead()));
    action->setShortcuts(KShortcut( "Ctrl+Shift+R" ));

    // Settings menu
    KToggleAction *sqf = coll->add<KToggleAction>("show_quick_filter");
    sqf->setText(i18n("Show Quick Filter"));
//.........这里部分代码省略.........
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:101,代码来源:actionmanagerimpl.cpp


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