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


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

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


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

示例1: icon

MainMenubar::MainMenubar (QMainWindow *mw) : QMenuBar (mw, "mainMenubar")
{
  actions.setAutoDelete(FALSE);

  RcFile rcfile;

  QPixmap icon(finished);
  QAction *action  = new QAction(this, "actionExit");
  action->setMenuText(tr("E&xit"));
  action->setIconSet(icon);
  action->setAccel(Qt::CTRL+Qt::Key_Q);
  action->setStatusTip(tr("Quit Qtstalker (Ctrl+Q)"));
  action->setToolTip(tr("Quit Qtstalker (Ctrl+Q)"));
  connect(action, SIGNAL(activated()), this, SIGNAL(signalExit()));
  actions.replace(Exit, action);

  icon = configure;
  action = new QAction(this, "actionOptions");
  action->setMenuText(tr("Edit &Preferences"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Modify user preferences (Ctrl+0)"));
  action->setToolTip(tr("Modify user preferences (Ctrl+0)"));
  connect(action, SIGNAL(activated()), mw, SLOT(slotOptions()));
  actions.replace(Options, action);

  icon = nav;
  bool b;
  rcfile.loadData(RcFile::ShowSidePanel, b);
  action = new QAction(this, "actionPanel");
  action->setMenuText(tr("Side &Panel"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Toggle side-panel view (Ctrl+1)"));
  action->setToolTip(tr("Toggle side-panel view (Ctrl+1)"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), mw, SLOT(slotHideNav(bool)));
  actions.replace(SidePanel, action);

  icon = gridicon;
  rcfile.loadData(RcFile::Grid, b);
  action = new QAction(this, "actionGrid");
  action->setMenuText(tr("Chart &Grid"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Toggle chart grid (Ctrl+2)"));
  action->setToolTip(tr("Toggle chart grid (Ctrl+2)"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalGrid(bool)));
  actions.replace(Grid, action);

  icon = scaletoscreen;
  rcfile.loadData(RcFile::ScaleToScreen, b);
  action = new QAction(this, "actionScale");
  action->setMenuText(tr("&Scale To Screen"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Scale chart to current screen data (Ctrl+3)"));
  action->setToolTip(tr("Scale chart to current screen data (Ctrl+3)"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalScale(bool)));
  actions.replace(ScaleToScreen, action);

  icon = crosshair;
  rcfile.loadData(RcFile::Crosshairs, b);
  action = new QAction(this, "actionCrosshairs");
  action->setMenuText(tr("Toggle &Crosshairs"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Toggle crosshairs (Ctrl+4)"));
  action->setToolTip(tr("Toggle crosshairs (Ctrl+4)"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalCrosshairs(bool)));
  actions.replace(Crosshairs, action);

  icon = co;
  rcfile.loadData(RcFile::DrawMode, b);
  action = new QAction(this, "actionDraw");
  action->setMenuText(tr("Toggle &Draw Mode"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Toggle drawing mode (Ctrl+5)"));
  action->setToolTip(tr("Toggle drawing mode (Ctrl+5)"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalDraw(bool)));
  actions.replace(DrawMode, action);

  icon = papertrade;
  rcfile.loadData(RcFile::PaperTradeMode, b);
  action = new QAction(this, "actionPaperTrade");
  action->setMenuText(tr("Toggle &Trade Mode"));
  action->setIconSet(icon);
  action->setStatusTip(tr("Toggle paper-trade mode"));
  action->setToolTip(tr("Toggle paper-trade mode"));
  action->setToggleAction(TRUE);
  action->setOn(b);
  connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalPaperTrade(bool)));
  actions.replace(PaperTrade, action);

  icon = indicator;
  action = new QAction(this, "actionNewIndicator");
//.........这里部分代码省略.........
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:101,代码来源:MainMenubar.cpp

示例2: cfg


//.........这里部分代码省略.........
#endif

    a = new QAction( tr( "Goto Line..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                    QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( gotoLine() ) );
    edit->insertSeparator();
    a->addTo( edit );

    a = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
                     QString::null, 0, this, 0 );
    connect( a, SIGNAL( activated() ), this, SLOT( editFind() ) );
    a->addTo( bar );
    a->addTo( edit );

    zin = new QAction( tr("Zoom in"), QString::null, 0, this, 0 );
    connect( zin, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
    zin->addTo( font );

    zout = new QAction( tr("Zoom out"), QString::null, 0, this, 0 );
    connect( zout, SIGNAL( activated() ), this, SLOT( zoomOut() ) );
    zout->addTo( font );

    font->insertSeparator();

    font->insertItem(tr("Font"), this, SLOT(changeFont()) );

    font->insertSeparator();
    font->insertItem(tr("Advanced Features"), advancedMenu);

    QAction *wa = new QAction( tr("Wrap lines"),
                               QString::null, 0, this, 0 );
    connect( wa, SIGNAL( toggled(bool) ),
             this, SLOT( setWordWrap(bool) ) );
    wa->setToggleAction(true);
    wa->addTo( advancedMenu);

    desktopAction = new QAction( tr("Always open linked file"),
                                 QString::null, 0, this, 0 );
    connect( desktopAction, SIGNAL( toggled(bool) ),
             this, SLOT( doDesktop(bool) ) );
    desktopAction->setToggleAction(true);
    desktopAction->addTo( advancedMenu);

    filePermAction = new QAction( tr("File Permissions"),
                                  QString::null, 0, this, 0 );
    connect( filePermAction, SIGNAL( toggled(bool) ),
             this, SLOT( doFilePerms(bool) ) );
    filePermAction->setToggleAction(true);
    filePermAction->addTo( advancedMenu);

    nAutoSave = new QAction( tr("Auto Save 5 min."),
                                   QString::null, 0, this, 0 );
    connect( nAutoSave, SIGNAL( toggled(bool) ),
             this, SLOT( doTimer(bool) ) );
    nAutoSave->setToggleAction(true);
    nAutoSave->addTo( advancedMenu);

    mb->insertItem( tr( "File" ), file );
    mb->insertItem( tr( "Edit" ), edit );
    mb->insertItem( tr( "View" ), font );

    searchBar = new QToolBar(this);
    addToolBar( searchBar,  "Search", QMainWindow::Top, true );

    searchBar->setHorizontalStretchable( true );
开发者ID:opieproject,项目名称:opie,代码行数:66,代码来源:textedit.cpp


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