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


C++ QMenu::setIcon方法代码示例

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


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

示例1: addClassViewContextMenuAddActions

bool EditorFrame::addClassViewContextMenuAddActions(bool clearMenu)
{
  bool success = false;

  if(!mContextMenu){
    return success;
  }

  if(clearMenu){
    mContextMenu->clear();
  }

  openstudio::IddFile iddFile = mModelExplorer->getIddFile();
  std::string group;
  std::vector<std::string> groups = iddFile.groups();
  openstudio::IddObject object;
  std::vector<openstudio::IddObject> objects;

  QAction * newAddAction = nullptr;
  QString name;
  QString string;
  QMenu * addSubMenu = nullptr;

  for(unsigned i=0 ; i<groups.size(); i++){
    group = groups.at(i);
    objects = iddFile.getObjectsInGroup(group);
    QMenu * subMenu = new QMenu(group.c_str());
    subMenu->setIcon(QIcon(":/images/edit_add.png"));
    for(unsigned j=0 ; j<objects.size(); j++){
      object = objects.at(j);
      name = object.name().c_str();
      string = mActionDescriptionPrefix + name;
      newAddAction = new QAction(QIcon(":/images/edit_add.png"), tr(string.toStdString().c_str()), this);
      ///! No connection required as the context menu will always call addObject()
      ///! Context menu signal has QAction->text() to pass to addObject()
      subMenu->addAction(newAddAction);
    }
    if(objects.size() && subMenu){
      if(!success){
        addSubMenu = new QMenu(tr("Add"));
        addSubMenu->setIcon(QIcon(":/images/edit_add.png"));
        OS_ASSERT(addSubMenu);
        mContextMenu->addMenu(addSubMenu);
        success = true;
      }
      addSubMenu->addMenu(subMenu);
    }
  }

  if(!success){
    QAction * inactiveAddAction = new QAction(QIcon(":/images/edit_add_off.png"), tr("Nothing available to add to this object"), this);
    mContextMenu->addAction(inactiveAddAction);
    success = true;
  }

  return success;
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:57,代码来源:EditorFrame.cpp

示例2: initMenu

void Monitor::initMenu()
{
	/* Menu bar */
	Q_ASSERT(layout() != NULL);
	layout()->setMenuBar(new QMenuBar(this));
	
	/* Universe menu */
	QMenu* universeMenu = new QMenu(layout()->menuBar());
	universeMenu->setTitle(tr("Universe"));
	qobject_cast <QMenuBar*> (layout()->menuBar())->addMenu(universeMenu);
	QListIterator <QAction*> it(m_universeActions);
	while (it.hasNext() == true)
		universeMenu->addAction(it.next());

	/* Display menu */
	QMenu* displayMenu = new QMenu(layout()->menuBar());
	displayMenu->setTitle("Display");
	qobject_cast <QMenuBar*> (layout()->menuBar())->addMenu(displayMenu);
	displayMenu->addAction(m_fontAction);
	displayMenu->addSeparator();

	/* Update speed (inside display menu) */
	QMenu* speedMenu = new QMenu(displayMenu);
	displayMenu->addMenu(speedMenu);
	speedMenu->setTitle("Update speed");
	speedMenu->setIcon(QIcon(":/clock.png"));
	speedMenu->addAction(m_16HzAction);
	speedMenu->addAction(m_32HzAction);
	speedMenu->addAction(m_64HzAction);

	connect(universeMenu, SIGNAL(triggered(QAction*)),
		this, SLOT(slotUniverseTriggered(QAction*)));
}
开发者ID:speakman,项目名称:qlc,代码行数:33,代码来源:monitor.cpp

示例3: QMenu

    QMenu *CodeLineEdit::createVariablesMenu(QMenu *parentMenu, bool ignoreMultiline)
    {
        QMenu *variablesMenu = 0;

        if(!ignoreMultiline && isMultiline())
        {
            variablesMenu = new QMenu(tr("Cannot insert in a multiline parameter"), parentMenu);
            variablesMenu->setEnabled(false);
        }
        else
        {
            Q_ASSERT(mParameterContainer);
            variablesMenu = mParameterContainer->createVariablesMenu(parentMenu);
            if(variablesMenu)
            {
                variablesMenu->setTitle(tr("Insert variable"));
            }
            else
            {
                variablesMenu = new QMenu(tr("No variables to insert"), parentMenu);
                variablesMenu->setEnabled(false);
            }
        }

        variablesMenu->setIcon(QIcon(":/images/variable.png"));

        return variablesMenu;
    }
开发者ID:WeDo30,项目名称:actiona,代码行数:28,代码来源:codelineedit.cpp

示例4: changeState

void TrayMenu::changeState(int state){
	static int phase = 1;
	RTorrent * torrent = dynamic_cast<RTorrent *>(sender());
	if(!torrent) return;
	QMenu * tmenu = torrents[torrent->getId()];
	if(torrent->getState())
		tmenu->setIcon(QIcon(":/img/open.png")); 
	else
		tmenu->setIcon(QIcon(":/img/close.png")); 

	if(torrent->isHashChecking())
	{
		phase=phase?0:1;
		tmenu->setIcon(QIcon(QString(":/img/rehash%1.png").arg(phase)));
	}
	
}
开发者ID:fuCtor,项目名称:rwin,代码行数:17,代码来源:traymenu.cpp

示例5: rightClickMenu

QMenu* DragLabel::rightClickMenu()
{
  if (!m_RightClickMenu) {
    m_RightClickMenu = new QMenu(this);
    QMenu* colorMenu = new QMenu("Color", this);
    colorMenu->setIcon(QIcon(":/icons/color.svg"));
    QActionGroup* colorGroup = new QActionGroup(this);
    pRedColorAction = new QAction(QIcon(":/icons/red.svg"), tr("&Red"), this);
    pRedColorAction->setCheckable(true);
    if(currentColor()== Qt::red)
        pRedColorAction->setChecked(true);

    pOrangeColorAction = new QAction(QIcon(":/icons/orange.svg"), tr("&Orange"), this);
    pOrangeColorAction->setCheckable(true);
    if(currentColor() == QColor(254,154,46))
        pOrangeColorAction->setChecked(true);

    pGreenColorAction = new QAction(QIcon(":/icons/green.svg"), tr("&Green"), this);
    pGreenColorAction->setCheckable(true);
    if(currentColor()== Qt::green)
        pGreenColorAction->setChecked(true);

    pWhiteColorAction = new QAction(QIcon(":/icons/white.svg"), tr("&White"), this);
    pWhiteColorAction->setCheckable(true);
    if(currentColor()== Qt::white)
        pWhiteColorAction->setChecked(true);

    pGrayColorAction = new QAction(QIcon(":/icons/gray.svg"), tr("&Gray"), this);
    pGrayColorAction->setCheckable(true);
    if(currentColor()== Qt::lightGray)
        pGrayColorAction->setChecked(true);

    //group
    colorGroup->addAction(pRedColorAction);
    colorGroup->addAction(pOrangeColorAction);
    colorGroup->addAction(pGreenColorAction);
    colorGroup->addAction(pWhiteColorAction);
    colorGroup->addAction(pGrayColorAction);
    colorGroup->setExclusive(true);
    connect(colorGroup,SIGNAL(triggered(QAction *)),this,SLOT(changeColorSlot(QAction*)));

    //menu
    colorMenu->addAction(pRedColorAction);
    colorMenu->addAction(pOrangeColorAction);
    colorMenu->addAction(pGreenColorAction);
    colorMenu->addSeparator();
    colorMenu->addAction(pWhiteColorAction);
    colorMenu->addAction(pGrayColorAction);

    QAction* pDeleteAction = new QAction(QIcon(":/icons/delete.svg"), tr("&Delete"), this);
    connect(pDeleteAction,SIGNAL(triggered()),this,SLOT(deleteItemSlot()));


    m_RightClickMenu->addMenu(colorMenu);
    m_RightClickMenu->addAction(pDeleteAction);
  }
开发者ID:safrm,项目名称:semaphored,代码行数:56,代码来源:draglabel.cpp

示例6: photoTreeWidgetCustomPopupMenu

void PhotoDialog::photoTreeWidgetCustomPopupMenu( QPoint point )
{

      QMenu contextMnu( this );
      QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
      
      QAction *openphotoAct = new QAction(QIcon(":/images/openimage.png"), tr( "Open" ), this );
      openphotoAct->setShortcut(Qt::CTRL + Qt::Key_O);
      connect( openphotoAct , SIGNAL( triggered(QTreeWidgetItem * , int) ), this, SLOT( showPhoto( QTreeWidgetItem *, int ) ) );

      QAction *removephotoAct = new QAction(QIcon(IMAGE_REMOVE), tr( "Remove" ), this );
      removephotoAct->setShortcut(Qt::Key_Delete);
      connect( removephotoAct , SIGNAL( triggered() ), this, SLOT( removePhoto() ) );
      
      rateExcellenAct = new QAction(QIcon(":/images/rate-5.png"), tr("Excellent"), this);
      rateExcellenAct->setShortcut(Qt::CTRL + Qt::Key_5);
      connect(rateExcellenAct, SIGNAL(triggered()), this, SLOT(rateExcellent()));
      
      rateGoodAct = new QAction(QIcon(":/images/rate-4.png"), tr("Good"), this);
      rateGoodAct->setShortcut(Qt::CTRL + Qt::Key_4);
      connect(rateGoodAct, SIGNAL(triggered()), this, SLOT(rateGood()));
      
      rateAverageAct = new QAction(QIcon(":/images/rate-3.png"), tr("Average"), this);
      rateAverageAct->setShortcut(Qt::CTRL + Qt::Key_3);
      connect(rateAverageAct, SIGNAL(triggered()), this, SLOT(rateAvarge()));
      
      rateBelowAvarageAct = new QAction(QIcon(":/images/rate-2.png"), tr("Below avarage"), this);
      rateBelowAvarageAct->setShortcut(Qt::CTRL + Qt::Key_2);
      connect(rateBelowAvarageAct, SIGNAL(triggered()), this, SLOT(rateBelowAverage()));      
      
      rateBadAct = new QAction(QIcon(":/images/rate-1.png"), tr("Bad"), this);
      rateBadAct->setShortcut(Qt::CTRL + Qt::Key_1);
      connect(rateBadAct, SIGNAL(triggered()), this, SLOT(rateBad()));
      
      rateUnratedAct = new QAction(tr("Unrated"), this);
      rateUnratedAct->setShortcut(Qt::CTRL + Qt::Key_0);
      connect(rateUnratedAct, SIGNAL(triggered()), this, SLOT(rateUnrated()));
      
      QMenu *ratingMenu = new QMenu(tr("Rating"), this);
      ratingMenu->setIcon(QIcon(":/images/rating.png"));
      ratingMenu->addAction(rateExcellenAct);
      ratingMenu->addAction(rateGoodAct);
      ratingMenu->addAction(rateAverageAct);
      ratingMenu->addAction(rateBelowAvarageAct);
      ratingMenu->addAction(rateBadAct);
      ratingMenu->addAction(rateUnratedAct);

      contextMnu.clear();
      contextMnu.addAction(openphotoAct);
      contextMnu.addSeparator();
      contextMnu.addMenu( ratingMenu);
      contextMnu.addSeparator();
      contextMnu.addAction(removephotoAct); 
      contextMnu.exec( mevent->globalPos() );
}
开发者ID:MrKID,项目名称:RetroShare,代码行数:55,代码来源:PhotoDialog.cpp

示例7: initCapabilityMenu

void ConsoleChannel::initCapabilityMenu(const QLCChannel* ch)
{
    QLCCapability* cap;
    QMenu* valueMenu;
    QAction* action;
    QString s;
    QString t;

    QListIterator <QLCCapability*> it(ch->capabilities());
    while (it.hasNext() == true)
    {
        cap = it.next();

        // Set the value range and name as the menu item's name
        s = QString("%1: %2 - %3").arg(cap->name())
            .arg(cap->min()).arg(cap->max());

        if (cap->max() - cap->min() > 0)
        {
            // Create submenu for ranges of more than one value
            valueMenu = new QMenu(m_menu);
            valueMenu->setTitle(s);

            /* Add a color icon */
            if (ch->group() == QLCChannel::Colour)
                valueMenu->setIcon(colorIcon(cap->name()));

            for (int i = cap->min(); i <= cap->max(); i++)
            {
                action = valueMenu->addAction(
                             t.sprintf("%.3d", i));
                action->setData(i);
            }

            m_menu->addMenu(valueMenu);
        }
        else
        {
            // Just one value in this range, put that into the menu
            action = m_menu->addAction(s);
            action->setData(cap->min());

            /* Add a color icon */
            if (ch->group() == QLCChannel::Colour)
                action->setIcon(colorIcon(cap->name()));
        }
    }

    // Connect menu item activation signal to this
    connect(m_menu, SIGNAL(triggered(QAction*)),
            this, SLOT(slotContextMenuTriggered(QAction*)));

    // Set the menu also as the preset button's popup menu
    m_presetButton->setMenu(m_menu);
}
开发者ID:Boudewijn26,项目名称:qlcplus,代码行数:55,代码来源:consolechannel.cpp

示例8: QMenu

    QMenu *VariableLineEdit::createResourcesMenu(QMenu *parentMenu, bool ignoreMultiline)
    {
        Q_UNUSED(ignoreMultiline)

        //Do not allow inserting resources here, it doen't make any sense since we cannot overwrite resources

        QMenu *resourceMenu = new QMenu(tr("Cannot insert resources here"), parentMenu);
        resourceMenu->setEnabled(false);
        resourceMenu->setIcon(QIcon(":/images/resource.png"));

        return resourceMenu;
    }
开发者ID:sakazuki,项目名称:actiona,代码行数:12,代码来源:variablelineedit.cpp

示例9: crearMenu

/*!
    \fn productos::crearMenu( QMenuBar *m )
 */
void productos::crearMenu( QMenuBar *m )
{
 QMenu *menuHer = m->findChild<QMenu *>( "menuHerramientas" );
 if( menuHer != 0 ) {
     QMenu *menuProductos = menuHer->addMenu( "Productos" );
     menuProductos->setIcon( ActProductos->icon() );
     menuProductos->setObjectName( "menuProductos" );
     menuProductos->addAction( ActProductos );
     if( preferencias::getInstancia()->value( "Preferencias/Productos/categorias" ).toBool() )
     { menuProductos->addAction( ActCategorias ); }
     menuProductos->addAction( ActRemarcar );
 }
}
开发者ID:chungote,项目名称:gestotux,代码行数:16,代码来源:productos.cpp

示例10: createLanguagesMenu

QMenu* Translator::createLanguagesMenu(QMap<QAction*, QString> &actionLanguage) {
        QMenu *languagesMenu = new QMenu(tr("GoogleTranslate"));
        languagesMenu->setIcon(QIcon(":/images/google.png"));
	actionLanguage[languagesMenu->addAction(tr("Restore original"))] = "-";
	languagesMenu->addSeparator();
        for (int i = 0; i < languageCodesSorted.size(); ++i) {
                QString languageCode = languageCodesSorted[i];
                QString country = "";
                if (countries.find(languageCode) != countries.end()) country = countries[languageCode];
                else country = languageCode.mid(0, 2);
                actionLanguage[languagesMenu->addAction(QIcon(":/images/countries/" + country + ".png"), languages[languageCode])] = languageCode;
	}
	return languagesMenu;
}
开发者ID:artikz,项目名称:qwit,代码行数:14,代码来源:Translator.cpp

示例11: selectedIndexes

void
FileView::contextMenuEvent( QContextMenuEvent *e )
{
    if( !model() )
        return;

    //trying to do fancy stuff while showing places only leads to tears!
    if( model()->objectName() == "PLACESMODEL" )
    {
        e->accept();
        return;
    }

    QModelIndexList indices = selectedIndexes();
    // Abort if nothing is selected
    if( indices.isEmpty() )
        return;

    KMenu menu;
    foreach( QAction *action, actionsForIndices( indices, PlaylistAction ) )
        menu.addAction( action );
    menu.addSeparator();

    // Create Copy/Move to menu items
    // ported from old filebrowser
    QList<Collections::Collection*> writableCollections;
    QHash<Collections::Collection*, CollectionManager::CollectionStatus> hash =
            CollectionManager::instance()->collections();
    QHash<Collections::Collection*, CollectionManager::CollectionStatus>::const_iterator it =
            hash.constBegin();
    while( it != hash.constEnd() )
    {
        Collections::Collection *coll = it.key();
        if( coll && coll->isWritable() )
            writableCollections.append( coll );
        ++it;
    }
    if( !writableCollections.isEmpty() )
    {
        QMenu *copyMenu = new QMenu( i18n( "Copy to Collection" ), &menu );
        copyMenu->setIcon( KIcon( "edit-copy" ) );
        foreach( Collections::Collection *coll, writableCollections )
        {
            CollectionAction *copyAction = new CollectionAction( coll, &menu );
            connect( copyAction, SIGNAL(triggered()), this, SLOT(slotPrepareCopyTracks()) );
            copyMenu->addAction( copyAction );
        }
开发者ID:cancamilo,项目名称:amarok,代码行数:47,代码来源:FileView.cpp

示例12: init

bool ApplicationsMenuApplet::init(QWidget* parent)
{
  if(m_settings.type() == QVariant::List)
  {
    QVariantList list = m_settings.value<QVariantList>();

    while(!list.isEmpty())
    {
      const char** names = reinterpret_cast<const char**>(list.takeFirst().value<void*>());

      QMenu* menu = m_menu->addMenu(g_menu_names.value(names[0]));
      menu->setIcon(QIcon::fromTheme(names[1]).pixmap(menu->height(),menu->height()));
      m_menus.insert(g_menu_names.value(names[0]), menu);
    }

    QStringList categories;
    for(QList<DesktopEntryObject*>::iterator pos = m_entries.begin(); pos != m_entries.end(); ++pos)
    {
      if(m_menus.contains((*pos)->Category()))
        m_menus[(*pos)->Category()]->addAction((*pos)->Action());
      else
        m_menus["Other"]->addAction((*pos)->Action());
/*
      categories = (*pos)->Categories();
      for(QStringList::iterator pos2 = categories.begin(); pos2 != categories.end(); ++pos2)
        if(m_menus.contains(*pos2))
          m_menus[*pos2]->addAction((*pos)->Action());
*/
    }
  }

  m_menu->addSeparator();
  m_menu->addAction(QIcon::fromTheme("application-exit"), "Quit", qApp, SLOT(quit()));

/*
  connect(DesktopApplications::instance(), SIGNAL(applicationUpdated(const DesktopApplication&)), this, SLOT(onApplicationUpdated(const DesktopApplication&)));
  connect(DesktopApplications::instance(), SIGNAL(applicationRemoved(const QString&)), this, SLOT(onApplicationRemoved(const QString&)));

  QList<DesktopApplication> apps = DesktopApplications::instance()->applications();
  foreach(const DesktopApplication& app, apps)
    onApplicationUpdated(app);
*/

  return true;
}
开发者ID:GravisZro,项目名称:qtpanel,代码行数:45,代码来源:applicationsmenuapplet.cpp

示例13: genItemPopup

QMenu* EventCanvas::genItemPopup(CItem* item)/*{{{*/
{
    QMenu* notePopup = new QMenu(this);
    QMenu* colorPopup = notePopup->addMenu(tr("Part Color"));

    QMenu* colorSub;
    for (int i = 0; i < NUM_PARTCOLORS; ++i)
    {
        QString colorname(config.partColorNames[i]);
        if(colorname.contains("menu:", Qt::CaseSensitive))
        {
            colorSub = colorPopup->addMenu(colorname.replace("menu:", ""));
        }
        else
        {
            if(item->part()->colorIndex() == i)
            {
                colorname = QString(config.partColorNames[i]);
                colorPopup->setIcon(partColorIcons.at(i));
                colorPopup->setTitle(colorSub->title()+": "+colorname);

                colorname = QString("* "+config.partColorNames[i]);
                QAction *act_color = colorSub->addAction(partColorIcons.at(i), colorname);
                act_color->setData(20 + i);
            }
            else
            {
                colorname = QString("     "+config.partColorNames[i]);
                QAction *act_color = colorSub->addAction(partColorIcons.at(i), colorname);
                act_color->setData(20 + i);
            }
        }
    }

    notePopup->addSeparator();
    for (unsigned i = 0; i < 9; ++i)
    {
        if ((_canvasTools & (1 << i)) == 0)
            continue;
        QAction* act = notePopup->addAction(QIcon(*toolList[i].icon), tr(toolList[i].tip));
        act->setData(1 << i);
    }

    return notePopup;
}/*}}}*/
开发者ID:ViktorNova,项目名称:los,代码行数:45,代码来源:EventCanvas.cpp

示例14: addTreeViewContextMenuAddActions

bool EditorFrame::addTreeViewContextMenuAddActions(bool clearMenu)
{
  bool success = false;

  if(!mContextMenu){
    return success;
  }

  if(clearMenu){
    mContextMenu->clear();
  }

  mAllowableChildTypes.clear();
  mAllowableChildTypes = mModelExplorer->getAllowableChildTypes();
  QMenu * addSubMenu = nullptr;
  //bool connected = false;
  QString name;
  QString string;
  for(unsigned i=0 ; i<mAllowableChildTypes.size(); i++){
    if(addSubMenu == nullptr){
      addSubMenu = new QMenu(tr("Add"));
      addSubMenu->setIcon(QIcon(":/images/edit_add.png"));
      OS_ASSERT(addSubMenu);
      mContextMenu->addMenu(addSubMenu);
    }
    name = mAllowableChildTypes.at(i).valueName().c_str();
    string = mActionDescriptionPrefix + name;
    QAction * newAddAction = new QAction(QIcon(":/images/edit_add.png"), tr(string.toStdString().c_str()), this);
    ///! No connection required as the context menu will always call addObject()
    ///! Context menu signal has QAction->text() to pass to addObject()
    addSubMenu->addAction(newAddAction);
  }
  if(mAllowableChildTypes.size()){
    success = true;
  }

  if(!success){
    QAction * inactiveAddAction = new QAction(QIcon(":/images/edit_add_off.png"), tr("Nothing available to add to this object"), this);
    mContextMenu->addAction(inactiveAddAction);
    success = true;
  }

  return success;
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:44,代码来源:EditorFrame.cpp

示例15: updateAppList

//===========
//  PRIVATE
//===========
void AppMenu::updateAppList(){
  this->clear();
  APPS.clear();
  APPS = LXDG::sortDesktopCats( LXDG::systemDesktopFiles() );
  //Now fill the menu
  bool ok; //for checking inputs
    //--Look for the app store
    XDGDesktop store = LXDG::loadDesktopFile(appstorelink, ok);
    if(ok){ 
      this->addAction( LXDG::findIcon(store.icon, ""), tr("Get Applications"), this, SLOT(launchStore()) );
      this->addSeparator(); 
    }
    //--Now create the sub-menus
    QStringList cats = APPS.keys();
    cats.sort(); //make sure they are alphabetical
    for(int i=0; i<cats.length(); i++){
      //Make sure they are translated and have the right icons
      QString name, icon;
      if(cats[i] == "Multimedia"){ name = tr("Multimedia"); icon = "applications-multimedia"; }
      else if(cats[i] == "Development"){ name = tr("Development"); icon = "applications-development"; }
      else if(cats[i] == "Education"){ name = tr("Education"); icon = "applications-education"; }
      else if(cats[i] == "Game"){ name = tr("Games"); icon = "applications-games"; }
      else if(cats[i] == "Graphics"){ name = tr("Graphics"); icon = "applications-graphics"; }
      else if(cats[i] == "Network"){ name = tr("Network"); icon = "applications-internet"; }
      else if(cats[i] == "Office"){ name = tr("Office"); icon = "applications-office"; }
      else if(cats[i] == "Science"){ name = tr("Science"); icon = "applications-science"; }
      else if(cats[i] == "Settings"){ name = tr("Settings"); icon = "preferences-system"; }
      else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; }
      else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; }
      else{ name = tr("Unsorted"); icon = "applications-other"; }
      
      QMenu *menu = new QMenu(name, this);
      menu->setIcon(LXDG::findIcon(icon,""));
      connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(launchApp(QAction*)) );
      QList<XDGDesktop> appL = APPS.value(cats[i]);
      for( int a=0; a<appL.length(); a++){
        QAction *act = new QAction(LXDG::findIcon(appL[a].icon, ""), appL[a].name, this);
        act->setToolTip(appL[a].comment);
        act->setWhatsThis(appL[a].filePath);
        menu->addAction(act);
      }
      this->addMenu(menu);
    }
}
开发者ID:DJHartley,项目名称:pcbsd,代码行数:47,代码来源:AppMenu.cpp


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