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


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

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


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

示例1: makeListItem

QListWidgetItem* accountmanagerdialog::makeListItem(Account *acc)
{
    QString service = "FUCKING SOMETHING WRONG";
    switch(acc->type) {
        case FACEBOOK:
            service = "FACEBOOK";
            break;
        case GAPP:
            service = "GAPP";
            break;
        case GTALK:
            service = "GTALK";
            break;
    }
    int snip = acc->user.indexOf("@");
    QString username = "";
    if(snip!=-1)
        username = acc->user.left(snip);
    QString itemName = service + " " + username;
    QListWidgetItem *accItem = new QListWidgetItem();
    accItem->setText(itemName);
    accItem->setData(Qt::UserRole,qVariantFromValue((void*)acc));
    if(acc->active) {
        accItem->setIcon(QIcon(":/icons/active"));
    } else {
        accItem->setIcon(QIcon(":/icons/inactive"));
    }

    return accItem;
}
开发者ID:cbranch,项目名称:INSTANT-MAGNORMO,代码行数:30,代码来源:accountmanagerdialog.cpp

示例2: updateContents

void DesktopViewPlugin::updateContents(){
  list->clear();
  QDir dir(QDir::homePath()+"/Desktop");
  QFileInfoList files = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Type | QDir::DirsFirst);
  for(int i=0; i<files.length(); i++){
    QListWidgetItem *it = new QListWidgetItem;
    it->setWhatsThis(files[i].absoluteFilePath());
    if(files[i].isDir()){
	it->setIcon( LXDG::findIcon("folder","") );
	it->setText( files[i].fileName() );
    }else if(files[i].suffix() == "desktop" ){
	bool ok = false;
	XDGDesktop desk = LXDG::loadDesktopFile(files[i].absoluteFilePath(), ok);
	if(ok){
	  it->setIcon( LXDG::findIcon(desk.icon,"") );
          it->setText( desk.name );
	}else{
	  //Revert back to a standard file handling
          it->setIcon( LXDG::findMimeIcon(files[i].suffix()) );
          it->setText( files[i].fileName() );		
	}
    }else{
      it->setIcon( LXDG::findMimeIcon(files[i].suffix()) );
      it->setText( files[i].fileName() );
    }
    list->addItem(it);
  }
}
开发者ID:TetragrammatonHermit,项目名称:lumina,代码行数:28,代码来源:DesktopViewPlugin.cpp

示例3: refreshList

void TrendingTopicsWidget::refreshList() {
	QList<TrendingTopic> topics=currentTrends;
	if (mode==TrendingTopicsFetcher::Daily)
		topics=dailyTrends;
	else if (mode==TrendingTopicsFetcher::Weekly)
		topics=weeklyTrends;

	int height=0;
	ui.topics->clear();
	for(int x=0;x<topics.size();x++) {
		TrendingTopic topic = topics.at(x);
		QString name = QString::number(x+1)+". ";
		QListWidgetItem *item = new QListWidgetItem();
		name+=topic.name;
		item->setText(name);
		if (topic.prevPos==-1)
			item->setIcon(QIcon(":/trendstates/newentry.png"));
		else if (topic.prevPos==x)
			item->setIcon(QIcon(":/trendstates/stick.png"));
		else if (topic.prevPos>x)
			item->setIcon(QIcon(":/trendstates/up.png"));
		else
			item->setIcon(QIcon(":/trendstates/down.png"));

		ui.topics->addItem(item);

		if (currentName==topic.name) {
			item->setSelected(true);
			ui.topics->setCurrentItem(item);
		}
		height += ui.topics->visualItemRect(item).height();
	}
	ui.topics->setMinimumHeight(height);
	ui.topics->setMaximumHeight(height);
}
开发者ID:mrrooster,项目名称:Yasst,代码行数:35,代码来源:TrendingTopicsWidget.cpp

示例4: reload

void SchedulerForm::reload(){

    ui->listWidget->clear();
    ui->labelName->clear();
    ui->labelExecuted->clear();
    ui->scriptCodeDisplay->clear();

    QHash<QString, ScheduleInformation::Task>::iterator it = _info->tasks()->begin();
    while(it != _info->tasks()->end()){

        QListWidgetItem *item = new QListWidgetItem(ui->listWidget);
        item->setText(it.value().name);

        if(it.value().once){
            if(!it.value().done){
                item->setIcon(QIcon(":/icons/icons/task-single.png"));
            }else{
                item->setIcon(QIcon(":/icons/icons/done.png"));
            }
        }else{
            item->setIcon(QIcon(":/icons/icons/task-series.png"));
        }

        item->setData(50, it.key());
        item->setData(51, it.value().once);
        item->setData(52, it.value().done);
        item->setData(53, it.value().seconds);
        item->setData(54, it.value().count);
        item->setData(55, it.value().scriptCode);
        item->setData(56, it.value().name);
        item->setData(57, it.value().event);
        it++;
    }

}
开发者ID:okirmis,项目名称:sdb-manager,代码行数:35,代码来源:schedulerform.cpp

示例5: setUpGui

void LinkResourceDialog::setUpGui()
{
    QVBoxLayout* vbLayout = new QVBoxLayout(mainWidget());
    QLabel *resourceName = new QLabel(mainWidget());
    resourceName->setText(m_mainResource.genericLabel()+" : "+m_mainResource.className());
    m_resourceSearch = new KLineEdit(mainWidget());
    m_resourceSearch->setPlaceholderText(i18n("Search for resources"));
    vbLayout->addWidget(resourceName);
    vbLayout->addWidget(m_resourceSearch);
    connect(m_resourceSearch,SIGNAL(textChanged(QString)),this,SLOT(slotTriggerSearch(QString)));

    m_resourceList = new QListWidget(mainWidget());
    vbLayout->addWidget(m_resourceList);
    //m_resourceList->setViewMode(m_resourceList->IconMode);

    Q_FOREACH(Nepomuk::Resource resource, getLinkedResources()) {
        QListWidgetItem* item = new QListWidgetItem(resource.genericLabel(),m_resourceList);
        item->setCheckState(Qt::Checked);
        item->setToolTip(resource.uri());
        if(!resource.genericIcon().isEmpty()) {
            item->setIcon(KIcon(resource.genericIcon()));
        }
        else {
            item->setIcon(KIcon("nepomuk"));
        }
    }
开发者ID:gwpl,项目名称:resourcebrowser,代码行数:26,代码来源:linkresourcedialog.cpp

示例6: foundSearchItem

void MainUI::foundSearchItem(QString path){
   //To get the worker's results
  QListWidgetItem *it = new QListWidgetItem;
    it->setWhatsThis(path);
    it->setToolTip(path);
  //Now setup the visuals
  if(path.simplified().endsWith(".desktop")){
    bool ok = false;
    XDGDesktop desk(path);
    if( !desk.isValid() ){delete it; return; } //invalid file
    it->setText(desk.name);
    it->setIcon( LXDG::findIcon(desk.icon, "application-x-desktop") );
  }else{
    if(QFileInfo(path).isDir()){ 
      it->setIcon( LXDG::findIcon("inode-directory","") );
      it->setText( path.replace(QDir::homePath(), "~") );
    }else{ 
      if(QFileInfo(path).isExecutable()){
	it->setIcon( LXDG::findIcon("application-x-executable","") ); 
      }else{
        it->setIcon( LXDG::findMimeIcon(path.section("/",-1).section(".",-1)) ); 
      }
      it->setText( path.section("/",-1) );
    }
    
  }
  //Now add it to the widget
  ui->listWidget->addItem(it);
  if(ui->listWidget->count()>100){ searcher->StopSearch(); } //just in case
}
开发者ID:trueos,项目名称:lumina,代码行数:30,代码来源:MainUI.cpp

示例7: createIcons

void ConfigDialog::createIcons()
{
    QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
    configButton->setIcon(QIcon(":/images/config.png"));
    configButton->setText(tr("Settings"));
    configButton->setTextAlignment(Qt::AlignHCenter);
    configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);


    QListWidgetItem *cyclistButton = new QListWidgetItem(contentsWidget);
    cyclistButton->setIcon(QIcon(":images/cyclist.png"));
    cyclistButton->setText(tr("Athlete"));
    cyclistButton->setTextAlignment(Qt::AlignHCenter);
    cyclistButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *realtimeButton = new QListWidgetItem(contentsWidget);
    realtimeButton->setIcon(QIcon(":images/arduino.png"));
    realtimeButton->setText(tr("Devices"));
    realtimeButton->setTextAlignment(Qt::AlignHCenter);
    realtimeButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

#ifdef GC_HAVE_LIBOAUTH
    QListWidgetItem *twitterButton = new QListWidgetItem(contentsWidget);
    twitterButton->setIcon(QIcon(":images/twitter.png"));
    twitterButton->setText(tr("Twitter"));
    twitterButton->setTextAlignment(Qt::AlignHCenter);
    twitterButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
#endif

    connect(contentsWidget,
            SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
            this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));

    connect(saveButton, SIGNAL(clicked()), this, SLOT(save_Clicked()));
}
开发者ID:rodericj,项目名称:GoldenCheetah,代码行数:35,代码来源:ConfigDialog.cpp

示例8: populateList

void ToolbarEditor::populateList(QListWidget * w, QList<QAction *> actions_list, bool add_separators) {
	w->clear();

	QAction * action;
	for (int n = 0; n < actions_list.count(); n++) {
		action = static_cast<QAction*> (actions_list[n]);
		if (action) {
			if (!action->objectName().isEmpty()) {
				QListWidgetItem * i = new QListWidgetItem;
				QString text = fixname(action->text(), action->objectName());
				i->setText(text + " ("+ action->objectName() +")");
				QIcon icon = action->icon();
				if (icon.isNull()) {
					icon = Images::icon("empty_icon");
				}
				i->setIcon(icon);
				i->setData(Qt::UserRole, action->objectName());
				w->addItem(i);
			}
			else
			if ((action->isSeparator()) && (add_separators)) {
				QListWidgetItem * i = new QListWidgetItem;
				//i->setText(tr("(separator)"));
				i->setText("---------");
				i->setData(Qt::UserRole, "separator");
				i->setIcon(Images::icon("empty_icon"));
				w->addItem(i);
			}
		}
	}
}
开发者ID:dradetsky,项目名称:smplayer-mirror,代码行数:31,代码来源:toolbareditor.cpp

示例9:

void Widget3D::show_hide_actor(QListWidgetItem * itemDuble){

  itemDuble->setSelected(true);

  bool visible = m_source_list.at(m_actor_list->row(itemDuble))->getRepresentation(this->m_RenderView)->isVisible();

  for(int i=0;i<m_actor_list->selectedItems().size();++i)
  {
      QListWidgetItem * item = m_actor_list->selectedItems().at(i);

      //if actor is visible
      if(visible){
        //Hide actor/region : Change icon and text color
        item->setTextColor(Qt::gray);
        item->setIcon(QIcon(":/paraview_icons/pqEyeballd16.png"));
      }else{
        //Show actor/region : Change icon and text color
        item->setTextColor(Qt::black);
        item->setIcon(QIcon(":/paraview_icons/pqEyeball16.png"));
      }

      //Set actor/region visibility
      m_source_list.at(m_actor_list->selectionModel()->selectedRows().at(i).row())
          ->getRepresentation(this->m_RenderView)->setVisible(!visible);

  }

  //be sure the mesh is updated
  m_RenderView->getWidget()->update();
  reset_camera();

}
开发者ID:Ivor23,项目名称:coolfluid3,代码行数:32,代码来源:Widget3D.cpp

示例10: deskplugadded

//=================
//    PRIVATE SLOTS
//=================
void page_interface_desktop::deskplugadded(){
  GetPluginDialog dlg(this);
    dlg.LoadPlugins("desktop", PINFO);
    dlg.exec();
  if( !dlg.selected ){ return; } //cancelled
  QString newplug = dlg.plugID;
  QListWidgetItem *it = new QListWidgetItem();
  if(newplug=="applauncher"){
    //Prompt for the application to add
    XDGDesktop app = getSysApp();
    if(app.filePath.isEmpty()){ return; } //cancelled
    newplug.append("::"+app.filePath);
    //Now fill the item with the necessary info
    it->setWhatsThis(newplug);
    it->setText(app.name);
    it->setIcon(LXDG::findIcon(app.icon,"") );
    it->setToolTip(app.comment);
  }else{
    //Load the info for this plugin
    LPI info = PINFO->desktopPluginInfo(newplug);
    if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen)
    it->setWhatsThis(newplug);
    it->setText(info.name);
    it->setToolTip(info.description);
    it->setIcon( LXDG::findIcon(info.icon,"") );
  }
  ui->list_desktop_plugins->addItem(it);
  ui->list_desktop_plugins->scrollToItem(it);
  settingChanged();
}
开发者ID:jbenden,项目名称:lumina,代码行数:33,代码来源:page_interface_desktop.cpp

示例11: addItem

void ProgressLoggerGui::addItem(const QString &text, int flag)
{
    QListWidgetItem* item = new QListWidgetItem(text);

    switch(flag)
    {
        case LOGNOICON:
            break;
        case LOGOK:
            item->setIcon(QIcon(":/icons/go-next.png"));
            break;
        case LOGINFO:
            item->setIcon(QIcon(":/icons/dialog-information.png"));
            break;
        case LOGWARNING:
            item->setIcon(QIcon(":/icons/dialog-warning.png"));
            break;
        case LOGERROR:
            item->setIcon(QIcon(":/icons/dialog-error.png"));
            dp.saveLog->show();
            break;
    }

    dp.listProgress->addItem(item);
    dp.listProgress->scrollToItem(item);
}
开发者ID:4nykey,项目名称:rockbox,代码行数:26,代码来源:progressloggergui.cpp

示例12: QDialog

SettingsDialog::SettingsDialog(QWidget *parent)
    : QDialog(parent)
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui.setupUi(this);

    ui.contentsWidget->setMaximumWidth(120);

    ui.pagesStackedWidget->addWidget(new SettingsKeysWidget);
    ui.pagesStackedWidget->addWidget(new SettingsSSLWidget);

    QListWidgetItem *keyButton = new QListWidgetItem(ui.contentsWidget);
    keyButton->setIcon(QIcon(":/images/folder_big.png"));
    keyButton->setText(tr("Key Locations"));
    keyButton->setTextAlignment(Qt::AlignHCenter);
    keyButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *sslButton = new QListWidgetItem(ui.contentsWidget);
    sslButton->setIcon(QIcon(":/images/key.png"));
    sslButton->setText(tr("SSL"));
    sslButton->setTextAlignment(Qt::AlignHCenter);
    sslButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    ui.contentsWidget->setCurrentRow(0);

    connect(ui.contentsWidget,
            SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
            this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
}
开发者ID:darg0001,项目名称:evoting-systems,代码行数:29,代码来源:SettingsDialog.cpp

示例13: createIcons

void ConfigWidget::createIcons()
{
    QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
    configButton->setIcon(QIcon(":/images/network.png"));
    configButton->setText(tr("Network Settings"));
    configButton->setTextAlignment(Qt::AlignHCenter);
    configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
    queryButton->setIcon(QIcon(":/images/settings.png"));
    queryButton->setText(tr("Controller Settings"));
    queryButton->setTextAlignment(Qt::AlignHCenter);
    queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *consoleButton = new QListWidgetItem(contentsWidget);
    consoleButton->setIcon(QIcon(":/images/console.png"));
    consoleButton->setText(tr("Console / Ouptut"));
    consoleButton->setTextAlignment(Qt::AlignHCenter);
    consoleButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *gameButton = new QListWidgetItem(contentsWidget);
    gameButton->setIcon(QIcon(":/images/game.png"));
    gameButton->setText(tr("Game: Tetrix"));
    gameButton->setTextAlignment(Qt::AlignHCenter);
    gameButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);


    connect(contentsWidget,
            SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
}
开发者ID:Master-Thesis,项目名称:Generic-Sensor-Interface-Client,代码行数:31,代码来源:configwidget.cpp

示例14: createIcons

void ConfigDialog::createIcons()
{
    QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
    configButton->setIcon(QIcon(":/images/config.png"));
    configButton->setText(tr("        主页       "));
    configButton->setTextAlignment(Qt::AlignHCenter);
    configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *updateButton = new QListWidgetItem(contentsWidget);
    updateButton->setIcon(QIcon("image/order.jpg"));
    updateButton->setText(tr("信息"));
    updateButton->setTextAlignment(Qt::AlignHCenter);
    updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
    queryButton->setIcon(QIcon("image/equipment.jpg"));
    queryButton->setText(tr("器材"));
    queryButton->setTextAlignment(Qt::AlignHCenter);
    queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

    if (current_user == "admin") {
    QListWidgetItem *userButton = new QListWidgetItem(contentsWidget);
    userButton->setIcon(QIcon("image/user.jpg"));
    userButton->setText(tr("用户"));
    userButton->setTextAlignment(Qt::AlignHCenter);
    userButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    }

    connect(contentsWidget,
            SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
            this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*)));
}
开发者ID:EmbeddedSoftwareCaiShuPeng,项目名称:EquipmentManager,代码行数:32,代码来源:configdialog.cpp

示例15: showError

void ErrorReporter::showError(Error const &error, ErrorListWidget* const errorListWidget) const
{
	if (!errorListWidget)
		return;

	if (mErrorList && !mErrorList->isVisible() &&  mIsVisible)
		mErrorList->setVisible(true);

	QListWidgetItem* item = new QListWidgetItem(errorListWidget);
	QString message = error.timestamp() + " " + severityMessage(error) + " ";
	message += error.message();
	switch (error.severity()) {
	case Error::information:
		item->setIcon(QIcon(":/icons/information.png"));
		break;
	case Error::warning:
		item->setIcon(QIcon(":/icons/warning.png"));
		break;
	case Error::error:
		item->setIcon(QIcon(":/icons/error.png"));
		break;
	case Error::critical:
		item->setIcon(QIcon(":/icons/critical.png"));
		break;
	default:
		throw new Exception("Incorrect total severity");
	}
	item->setText(" " + message.trimmed());
	item->setTextAlignment(Qt::AlignVCenter);
	item->setToolTip(error.position().toString());
	errorListWidget->addItem(item);
}
开发者ID:MariaLitvinova,项目名称:qreal,代码行数:32,代码来源:errorReporter.cpp


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