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


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

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


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

示例1: Extension

  HydrogensExtension::HydrogensExtension(QObject *parent) : Extension(parent), m_molecule(0)
  {
    QAction *action = new QAction(this);
    action->setText(tr("Add Hydrogens"));
    m_actions.append(action);

    action = new QAction(this);
    action->setText(tr("Add Hydrogens for pH..."));
    m_actions.append(action);

    action = new QAction(this);
    action->setText(tr("Remove Hydrogens"));
    m_actions.append(action);

    action = new QAction( this );
    action->setSeparator(true);
    m_actions.append( action );
  }
开发者ID:ChrisWilliams,项目名称:avogadro,代码行数:18,代码来源:hydrogensextension.cpp

示例2: QDockWidget

PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setContextMenuPolicy(Qt::ActionsContextMenu);
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      QAction* a = new QAction(this);
      a->setText(tr("Single Palette"));
      a->setCheckable(true);
      a->setChecked(preferences.singlePalette);
      addAction(a);
      connect(a, SIGNAL(toggled(bool)), SLOT(setSinglePalette(bool)));

      QWidget* w = new QWidget(this);
      w->setContextMenuPolicy(Qt::NoContextMenu);
      QVBoxLayout* vl = new QVBoxLayout(w);
      vl->setMargin(0);
      QHBoxLayout* hl = new QHBoxLayout;
      hl->setContentsMargins(5,5,5,0);

      workspaceList = new QComboBox;
      workspaceList->setToolTip(tr("Select workspace"));
      updateWorkspaces();
      hl->addWidget(workspaceList);
      QToolButton* nb = new QToolButton;

      nb->setMinimumHeight(27);
      nb->setText(tr("+"));
      nb->setToolTip(tr("Add new workspace"));
      hl->addWidget(nb);

      setWidget(w);

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      vl->addWidget(sa);
      vl->addLayout(hl);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

      connect(nb, SIGNAL(clicked()), SLOT(newWorkspaceClicked()));
      connect(workspaceList, SIGNAL(activated(int)), SLOT(workspaceSelected(int)));
      }
开发者ID:HerbertYu,项目名称:MuseScore,代码行数:57,代码来源:palettebox.cpp

示例3: Extension

  PackmolExtension::PackmolExtension(QObject *parent) : Extension(parent), 
      m_molecule(0), m_dialog(0)
  {  
    QAction *action = new QAction(this);
    action->setText(tr("Packmol"));
    m_actions.append(action);

    createDialog();
  }
开发者ID:timvdm,项目名称:Avogadro-Packmol-Extension,代码行数:9,代码来源:packmolextension.cpp

示例4: setupGUILayout

void KBlocksWin::setupGUILayout()
{
    QAction *action;

    action = KStandardGameAction::gameNew(this, SLOT(singleGame()), actionCollection());
    action->setText(i18n("Single Game"));
    actionCollection()->addAction(QStringLiteral("newGame"), action);

    action = new QAction(this);
    action->setText(i18n("Human vs AI"));
    actionCollection()->addAction(QStringLiteral("pve_step"), action);
    connect(action, &QAction::triggered, this, &KBlocksWin::pveStepGame);

    m_pauseAction = KStandardGameAction::pause(this, SLOT(pauseGame()), actionCollection());
    actionCollection()->addAction(QStringLiteral("pauseGame"), m_pauseAction);
    m_pauseAction->setEnabled(false);

    action = KStandardGameAction::highscores(this, SLOT(showHighscore()), actionCollection());
    actionCollection()->addAction(QStringLiteral("showHighscores"), action);

    action = KStandardGameAction::quit(this, SLOT(close()), actionCollection());
    actionCollection()->addAction(QStringLiteral("quit"), action);

    KStandardAction::preferences(this, SLOT(configureSettings()), actionCollection());

    KToggleAction *soundAction = new KToggleAction(i18n("&Play sounds"), this);
    soundAction->setChecked(Settings::sounds());
    actionCollection()->addAction(QStringLiteral("sounds"), soundAction);
    connect(soundAction, &KToggleAction::triggered, this, &KBlocksWin::setSoundsEnabled);

    // TODO
    mScore = new QLabel(i18n("Points: 0 - Lines: 0 - Level: 0"));
    statusBar()->addPermanentWidget(mScore);
    connect(mpGameScene, &KBlocksScene::scoreChanged, this, &KBlocksWin::onScoreChanged);
    connect(mpGameScene, &KBlocksScene::isHighscore, this, &KBlocksWin::onIsHighscore);

    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::Easy, KgDifficultyLevel::Hard
    );
    KgDifficultyGUI::init(this);
    connect(Kg::difficulty(), &KgDifficulty::currentLevelChanged, this, &KBlocksWin::levelChanged);

    setupGUI();
}
开发者ID:KDE,项目名称:kblocks,代码行数:44,代码来源:KBlocksWin.cpp

示例5: separators

void tst_QActionGroup::separators()
{
    QMainWindow mw;
    QMenu menu(&mw);
    QActionGroup actGroup(&mw);

    mw.show();

#ifdef QT_SOFTKEYS_ENABLED
    // Softkeys add extra "Select" and "Back" actions to menu by default.
    // Two first actions will be Select and Back when softkeys are enabled
    int numSoftkeyActions = 2;
#else
    int numSoftkeyActions = 0;
#endif

    QAction *action = new QAction(&actGroup);
    action->setText("test one");

    QAction *separator = new QAction(&actGroup);
    separator->setSeparator(true);
    actGroup.addAction(separator);

    QListIterator<QAction*> it(actGroup.actions());
    while (it.hasNext())
        menu.addAction(it.next());

    QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions);

    it = QListIterator<QAction*>(actGroup.actions());
    while (it.hasNext())
        menu.removeAction(it.next());

    QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions);

    action = new QAction(&actGroup);
    action->setText("test two");

    it = QListIterator<QAction*>(actGroup.actions());
    while (it.hasNext())
        menu.addAction(it.next());

    QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions);
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:44,代码来源:tst_qactiongroup.cpp

示例6: font

LogWidget::LogWidget(QWidget *parent) 
 : QMainWindow(parent) {
	m_contents = new QTextEdit(this);
	QFont font("Monospace");
	font.setStyleHint(QFont::TypeWriter);
	m_contents->setFont(font);
	m_contents->setReadOnly(true);
	QPalette palette;
	palette.setColor(QPalette::Base, Qt::black);
	m_contents->setPalette(palette);
	setPalette(palette);
	QToolBar *toolBar = new QToolBar(this);
	toolBar->setMovable(false);
	toolBar->setAllowedAreas(Qt::TopToolBarArea);
	toolBar->setIconSize(QSize(32, 32));
	toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
	toolBar->setFloatable(false);

	QAction *actionShowStats = new QAction(this);
	QIcon showStatsIcon;
	showStatsIcon.addFile(QString::fromUtf8(":/resources/showStats.png"), QSize(), QIcon::Normal, QIcon::Off);
	actionShowStats->setIcon(showStatsIcon);
    actionShowStats->setToolTip(tr("Show statistics"));
    actionShowStats->setText(tr("Show Statistics"));
	connect(actionShowStats, SIGNAL(triggered()), this, SLOT(onShowStats()));
	toolBar->addAction(actionShowStats);
	QAction *actionClear = new QAction(this);
	QIcon clearIcon;
	clearIcon.addFile(QString::fromUtf8(":/resources/clear.png"), QSize(), QIcon::Normal, QIcon::Off);
	actionClear->setIcon(clearIcon);
    actionClear->setToolTip(tr("Clear"));
    actionClear->setText(tr("Clear"));
	connect(actionClear, SIGNAL(triggered()), m_contents, SLOT(clear()));
	toolBar->addAction(actionClear);
#if defined(__OSX__)
	toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif

    addToolBar(Qt::TopToolBarArea, toolBar);
	setCentralWidget(m_contents);
    setUnifiedTitleAndToolBarOnMac(true);
	setWindowTitle(tr("Log"));
	resize(QSize(1000, 500));
}
开发者ID:joewan,项目名称:mitsuba-renderer,代码行数:44,代码来源:logwidget.cpp

示例7: init

void SearchLaunch::init()
{
    Containment::init();
    connect(this, SIGNAL(appletAdded(Plasma::Applet*,QPointF)),
            this, SLOT(layoutApplet(Plasma::Applet*,QPointF)));
    connect(this, SIGNAL(appletRemoved(Plasma::Applet*)),
            this, SLOT(appletRemoved(Plasma::Applet*)));

    connect(this, SIGNAL(toolBoxVisibilityChanged(bool)), this, SLOT(updateConfigurationMode(bool)));


    setToolBox(Plasma::AbstractToolBox::load(corona()->preferredToolBoxPlugin(Plasma::Containment::DesktopContainment), QVariantList(), this));

    QAction *a = action("add widgets");
    if (a) {
        addToolBoxAction(a);
    }


    if (toolBox()) {
        connect(toolBox(), SIGNAL(toggled()), this, SIGNAL(toolBoxToggled()));
        connect(toolBox(), SIGNAL(visibilityChanged(bool)), this, SIGNAL(toolBoxVisibilityChanged(bool)));
        toolBox()->show();
    }

    a = action("configure");
    if (a) {
        addToolBoxAction(a);
        a->setText(i18n("Configure Search and Launch"));
    }


    QAction *lockAction = 0;
    if (corona()) {
        lockAction = corona()->action("lock widgets");
    }

    if (!lockAction || !lockAction->isEnabled()) {
        lockAction = new QAction(this);
        addAction("lock page", lockAction);
        lockAction->setText(i18n("Lock Page"));
        lockAction->setIcon(KIcon("object-locked"));
        QObject::connect(lockAction, SIGNAL(triggered(bool)), this, SLOT(toggleImmutability()));
    }
开发者ID:aarontc,项目名称:kde-workspace,代码行数:44,代码来源:sal.cpp

示例8: ui

KindleMainWindow::KindleMainWindow(Config::Class & cfg_) :
    ui(new Ui::MainWindow),
    cfg( cfg_ ),
    dictionaryBar( this, configEvents, cfg.editDictionaryCommandLine ),
    articleMaker( dictionaries, groupInstances, cfg.preferences.displayStyle ),
    articleNetMgr( this, dictionaries, articleMaker,
                   cfg.preferences.disallowContentFromOtherSites ),
    dictNetMgr( this ),
    wordFinder( this )
{
    qDebug() << "DISPLAY STYLE" << cfg.preferences.displayStyle;
    applyQtStyleSheet( cfg.preferences.displayStyle );
    ui->setupUi(this);

    QAction * actionClose = ui->actionClose;
    actionClose->setShortcut(Qt::ALT + Qt::Key_Escape);
    actionClose->setText(tr("Close") + "\tAlt+Back");
    addAction(actionClose);

    QAction * actionSelect = ui->actionSelect;
    actionSelect->setShortcut(Qt::Key_Select);
    ui->translateLine->addAction(actionSelect);

    connect( ui->translateLine, SIGNAL( textChanged( QString const & ) ),
               this, SLOT( translateInputChanged( QString const & ) ) );
    connect( ui->translateLine, SIGNAL( returnPressed() ),
             this, SLOT( translateInputFinished() ) );

    articleView = new ArticleView( this, articleNetMgr, dictionaries,
                                            groupInstances, false, cfg,
                                            dictionaryBar.toggleViewAction(),
                                            groupList );
    wordList = new QListWidget( this );

    ui->stackedWidget->addWidget(articleView);
    ui->stackedWidget->addWidget(wordList);

    connect( articleView, SIGNAL( typingEvent( QString const & ) ),
               this, SLOT( typingEvent( QString const & ) ) );

    // install filters
    ui->translateLine->installEventFilter( this );
    wordList->installEventFilter( this );
    wordList->viewport()->installEventFilter( this );

    connect( &wordFinder, SIGNAL( updated() ),
             this, SLOT( prefixMatchUpdated() ) );
    connect( &wordFinder, SIGNAL( finished() ),
             this, SLOT( prefixMatchFinished() ) );

    makeDictionaries();

    articleView->showDefinition( tr( "Welcome!" ), Instances::Group::HelpGroupId );

    ui->translateLine->setFocus();
}
开发者ID:Tvangeste,项目名称:Goldendict-Kindle,代码行数:56,代码来源:kindlemainwindow.cpp

示例9: EditTool

TerrainEditTool::TerrainEditTool(EditScene *editScene, QObject *parent)
    : EditTool(editScene, parent),
      _item(0)
{
    QAction *newPolygonAction = new QAction(this);
    newPolygonAction->setText(tr("New Polygon"));
    connect(newPolygonAction, SIGNAL(triggered()), this, SLOT(startNewPolygon()));
    _actions.append(newPolygonAction);
    initTerrain(editScene->getLevel()->getTerrain());
}
开发者ID:cdettmering,项目名称:fancyland-editor,代码行数:10,代码来源:TerrainEditTool.cpp

示例10: init

void KDEDKSysGuard::init()
{
    KActionCollection* actionCollection = new KActionCollection(this);

    QAction* action = actionCollection->addAction(QStringLiteral("Show System Activity"));
    action->setText(i18n("Show System Activity"));
    connect(action, &QAction::triggered, this, &KDEDKSysGuard::showTaskManager);

    KGlobalAccel::self()->setGlobalShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_Escape));
}
开发者ID:cmacq2,项目名称:plasma-workspace,代码行数:10,代码来源:kdedksysguard.cpp

示例11: QLabel

Kontomierz::Kontomierz()
{
    QLabel* l = new QLabel( this );
    l->setText( "Hello World!" );
    setCentralWidget( l );
    QAction* a = new QAction(this);
    a->setText( "Quit" );
    connect(a, SIGNAL(triggered()), SLOT(close()) );
    menuBar()->addMenu( "File" )->addAction( a );
}
开发者ID:Hinrich,项目名称:Kontomierz,代码行数:10,代码来源:Kontomierz.cpp

示例12: createContextMenu

void FrameLabel::createContextMenu()
{
    // Create top-level menu object
    menu = new QMenu(this);
    // Add actions
    QAction *action;
    action = new QAction(this);
    action->setText(tr("Reset ROI"));
    menu->addAction(action);
    action = new QAction(this);
    action->setText(tr("Scale to Fit Frame"));
    action->setCheckable(true);
    menu->addAction(action);
    menu->addSeparator();
    // Create image processing menu object
    QMenu* menu_imgProc = new QMenu(this);
    menu_imgProc->setTitle("Image Processing");
    menu->addMenu(menu_imgProc);
    // Add actions
    action = new QAction(this);
    action->setText(tr("Grayscale"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Smooth"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Dilate"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Erode"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Flip"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Canny"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    menu_imgProc->addSeparator();
    action = new QAction(this);
    action->setText(tr("Settings..."));
    menu_imgProc->addAction(action);
}
开发者ID:Bukharitsyn,项目名称:qt-opencv-multithreaded,代码行数:48,代码来源:FrameLabel.cpp

示例13: createAction

/**
 * Create an action for an entry in the context menu.
 * @param text     the text of the action
 * @param method   the method to call when triggered
 * @param icon     the shown icon
 * @return         the created action
 */
QAction* RefactoringAssistant::createAction(const QString& text, const char * method, const Icon_Utils::IconType icon)
{
    Q_UNUSED(method);
    QAction* action = new QAction(this);
    action->setText(text);
    if (icon != Icon_Utils::N_ICONTYPES) {
        action->setIcon(Icon_Utils::SmallIcon(icon));
    }
    return action;
}
开发者ID:Salmista-94,项目名称:umbrello,代码行数:17,代码来源:refactoringassistant.cpp

示例14: toggleAction

void LoginDialog::toggleAction() {
    auto accountManager = DependencyManager::get<AccountManager>();
    QAction* loginAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
    Q_CHECK_PTR(loginAction);
    static QMetaObject::Connection connection;
    if (connection) {
        disconnect(connection);
    }

    if (accountManager->isLoggedIn()) {
        // change the menu item to logout
        loginAction->setText("Logout " + accountManager->getAccountInfo().getUsername());
        connection = connect(loginAction, &QAction::triggered, accountManager.data(), &AccountManager::logout);
    } else {
        // change the menu item to login
        loginAction->setText("Log In / Sign Up");
        connection = connect(loginAction, &QAction::triggered, [] { LoginDialog::showWithSelection(); });
    }
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:19,代码来源:LoginDialog.cpp

示例15: updateTrayMenu

void Window::updateTrayMenu(bool force) {
    if (!trayIconMenu || (cPlatform() == dbipWindows && !force)) return;

    bool active = isActive(false);
    if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
        QAction *first = trayIconMenu->actions().at(0);
        first->setText(lang(active ? lng_minimize_to_tray : lng_open_from_tray));
        disconnect(first, SIGNAL(triggered(bool)), 0, 0);
        connect(first, SIGNAL(triggered(bool)), this, active ? SLOT(minimizeToTray()) : SLOT(showFromTray()));
    } else {
开发者ID:AarashFarahani,项目名称:tdesktop,代码行数:10,代码来源:window.cpp


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