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


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

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


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

示例1: pm

/**
 * Funcion encargada de crear la GUI.
 * @b NOTA: esta funcion hace parte del motor de creacion de GUI en base a archivos XML.
 */
void sbgui::GUIMdiMainWindow::crearGUI()
{
	if( parser )
	{
		QStringList nombres = parser->obtenerNombres();
		HashMenu menusInfo = parser->obtenerMenus();

		for(uint i = 0; i < nombres.count(); i++)
		{
			QToolBar *toolBarTmp = new QToolBar(this, nombres[i]);
			moveDockWindow(toolBarTmp, Qt::DockTop);

			toolBarTmp->show();

			QStringList *strlistTmp = menusInfo.find((nombres)[i]);
			
			if (strlistTmp == 0)
			{
				std::cout << "GADMainWindow::crearGUI(): Error" << std::endl;
				return;
			}

			for (uint j = 0; j < strlistTmp->count(); j+=3)
			{
				QAction *actTmp = new QAction(toolBarTmp, (*strlistTmp)[j]);
				connect( actTmp, SIGNAL( activated() ) , this, SLOT( slotPrincipal() ) );
				
				// FIXME: colocar la ruta bien.
				QPixmap pm( sbqpack::GUIDATADIR + (*strlistTmp)[j+1]);
				if ( ! pm.isNull() )
					actTmp->setIconSet( pm );
				
				actTmp->setToolTip( (*strlistTmp)[j+2] );
				
				actTmp->addTo(toolBarTmp);
			}
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:qapital-svn,代码行数:43,代码来源:guimdimainwindow.cpp

示例2: 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

示例3: emplacement

/**************************************************************
 *  This is the main method which update the GUI
 *  according to the plugin's data
 *  @param pluginID the id of the plugin 
 *  @param type the type of the plugin
 *  @param infos plugin informations
 *
 *************************************************************/
void
MainWindow::updateGUIWithPluginData(const QString & pluginID,
                                    PluginType type,
                                    std::vector<MenuAddOn *> & infos)
{

  std::cout << "Dans updateGUIWithPluginData "<< std::endl
            << "taille d infos transmis " << infos.size() << std::endl;

  const int nbArgs = infos.size();

  //TODO : use Iterator instead of direct access
  for(int i=0; i<nbArgs; i++)
  {

    //First we retrieve the MenuAddOn
    MenuAddOn* infoMenu = infos[i];
    
    QString emplacement(infoMenu->emplacement->c_str());
    qDebug("emplacement = %s ", emplacement.latin1());

    // We split the string to learn where the plugin wants
    // to be connected with the GUI components
    QStringList decomposition = QStringList::split(INPUT_COMPONENT_SEPARATOR, emplacement);
    
    QString component = decomposition[0];
    qDebug("Compoment = %s ", component.latin1());


    //Which component ?
    //TODO: To IMPROVE the test
    if (component == "Menu")
    {
      QPopupMenu* aMenu;

      for(int j=1; j<decomposition.size()-1; j++)
      {
        aMenu = _menus.find(decomposition[j]);
        //Do we already have built this menu
        if(!aMenu)
        {

          QPopupMenu * aMenu = new QPopupMenu( this );
          _menus.insert(decomposition[j], aMenu);
          if (j == 1)
          {
            menuBar()->insertItem( decomposition[j], _menus[decomposition[j]]);
          }
          else
          {
            QPopupMenu* previousMenu = _menus.find(decomposition[j-1]);
            previousMenu->insertItem( decomposition[j], aMenu);
          }
        }
      }
      
      QAction* aAction = new QAction(this);
      aAction->setText    ( decomposition[decomposition.size() -1] );
      aAction->setMenuText( decomposition[decomposition.size() -1] );

      if( infoMenu->texte != NULL )
      {
        aAction->setAccel( QKeySequence( QString(infoMenu->texte->c_str()) ) );
      }
 
      if( infoMenu->image != NULL )
      {
        aAction->setIconSet( QIconSet(
                               QPixmap
                               (
                                 QString(IMAGES_DIR).append(infoMenu->image->c_str())
                                 ) ) );

        aAction->addTo( _toolBar);
      }
      
      QSignalMapper* _signalMapper = new QSignalMapper(this);
      _signalMapper->setMapping(aAction, pluginID);
      
      connect( aAction, SIGNAL(activated() ),
               _signalMapper, SLOT(map()) );


      switch(infoMenu->typeAppel)
      {
        case LOAD_CALL:
        {
          connect( _signalMapper, SIGNAL(mapped(const QString &) ),
                   _pluginManager, SLOT(executeLoad(const QString &)) );
          break;
        }
        
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:opale,代码行数:101,代码来源:mainwindow.cpp

示例4: MultiLineEditorBase

MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget,
				  FormWindow *fw, const QString &text )
    : MultiLineEditorBase( parent, 0, WType_Dialog | WShowModal ), formwindow( fw ), doWrap( FALSE )
{
    callStatic = call_static;

    if ( callStatic )
	applyButton->hide();

    textEdit = new TextEdit( centralWidget(), "textedit" );
    Layout4->insertWidget( 0, textEdit );

    if ( richtextMode ) {
	QPopupMenu *stylesMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Styles" ), stylesMenu );

	basicToolBar = new QToolBar( tr( "Basics" ), this, DockTop );

	ToolBarItem *it = new ToolBarItem( this, basicToolBar, tr( "Italic" ),
					   "i", QPixmap::fromMimeSource( "designer_textitalic.png" ), CTRL+Key_I );
	it->addTo( stylesMenu );
	connect( it, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *b = new ToolBarItem( this, basicToolBar, tr( "Bold" ),
					  "b", QPixmap::fromMimeSource( "designer_textbold.png" ), CTRL+Key_B );
	b->addTo( stylesMenu );
	connect( b, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ul = new ToolBarItem( this, basicToolBar, tr( "Underline" ),
					   "u", QPixmap::fromMimeSource( "designer_textunderline.png" ), CTRL+Key_U );
	ul->addTo( stylesMenu );
	connect( ul, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *tt = new ToolBarItem( this, basicToolBar, tr( "Typewriter" ),
					   "tt", QPixmap::fromMimeSource( "designer_textteletext.png" ) );
	tt->addTo( stylesMenu );
	connect( tt, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	basicToolBar->addSeparator();

	QPopupMenu *layoutMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Layout" ), layoutMenu );

	QAction *brAction = new QAction( this );
	brAction->setIconSet( QPixmap::fromMimeSource( "designer_textlinebreak.png" ) );
	brAction->setText( tr("Break" ) );
	brAction->addTo( basicToolBar );
	brAction->addTo( layoutMenu );
	connect( brAction, SIGNAL( activated() ) , this, SLOT( insertBR() ) );

	ToolBarItem *p = new ToolBarItem( this, basicToolBar, tr( "Paragraph" ),
					  "p", QPixmap::fromMimeSource( "designer_textparagraph.png" ) );
	p->addTo( layoutMenu );
	connect( p, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));
	layoutMenu->insertSeparator();
	basicToolBar->addSeparator();

	ToolBarItem *al = new ToolBarItem( this, basicToolBar, tr( "Align left" ),
					   "p align=\"left\"", QPixmap::fromMimeSource( "designer_textleft.png" ) );
	al->addTo( layoutMenu );
	connect( al, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ac = new ToolBarItem( this, basicToolBar, tr( "Align center" ),
					   "p align=\"center\"", QPixmap::fromMimeSource( "designer_textcenter.png" ) );
	ac->addTo( layoutMenu );
	connect( ac, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ar = new ToolBarItem( this, basicToolBar, tr( "Align right" ),
					   "p align=\"right\"", QPixmap::fromMimeSource( "designer_textright.png" ) );
	ar->addTo( layoutMenu );
	connect( ar, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *block = new ToolBarItem( this, basicToolBar, tr( "Blockquote" ),
					      "blockquote", QPixmap::fromMimeSource( "designer_textjustify.png" ) );
	block->addTo( layoutMenu );
	connect( block, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));


	QPopupMenu *fontMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Font" ), fontMenu );

	fontToolBar = new QToolBar( "Fonts", this, DockTop );

	QAction *fontAction = new QAction( this );
	fontAction->setIconSet( QPixmap::fromMimeSource( "designer_textfont.png" ) );
	fontAction->setText( tr("Font" ) );
	fontAction->addTo( fontToolBar );
	fontAction->addTo( fontMenu );
	connect( fontAction, SIGNAL( activated() ) , this, SLOT( showFontDialog() ) );


//.........这里部分代码省略.........
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:multilineeditorimpl.cpp


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