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


C++ QListViewItem::setPixmap方法代码示例

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


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

示例1: moveBookmark

void BookmarksSettingsPage::moveBookmark(int direction)
{
    // this implementation currently only allows moving of bookmarks
    // one step up or down
    assert((direction >= -1) && (direction <= +1));

    // swap bookmarks in listview
    QListViewItem* selectedItem = m_listView->selectedItem();
    assert(selectedItem != 0);
    QListViewItem* item = (direction < 0) ? selectedItem->itemAbove() :
                          selectedItem->itemBelow();
    assert(item != 0);

    QPixmap pixmap;
    if (item->pixmap(0) != 0) {
        pixmap = *(item->pixmap(0));
    }
    QString name(item->text(NameIdx));
    QString url(item->text(URLIdx));
    QString icon(item->text(IconIdx));

    if (selectedItem->pixmap(0) != 0) {
        item->setPixmap(PixmapIdx, *(selectedItem->pixmap(0)));
    }
    item->setText(NameIdx, selectedItem->text(NameIdx));
    item->setText(URLIdx, selectedItem->text(URLIdx));
    item->setText(IconIdx, selectedItem->text(IconIdx));

    selectedItem->setPixmap(PixmapIdx, pixmap);
    selectedItem->setText(NameIdx, name);
    selectedItem->setText(URLIdx, url);
    selectedItem->setText(IconIdx, icon);

    m_listView->setSelected(item, true);
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:35,代码来源:bookmarkssettingspage.cpp

示例2: insertAppLnks

void ButtonUtils::insertAppLnks ( QListViewItem *here )
{
    QStringList types = m_apps->types();
    QListViewItem *typeitem [types.count()];

    int i = 0;
    for ( QStringList::Iterator it = types.begin(); it != types.end(); ++it ) {
        QListViewItem *item = new QListViewItem ( here, m_apps->typeName ( *it ));
        item->setPixmap ( 0, m_apps->typePixmap ( *it ));

        typeitem [i++] = item;
    }

    for ( QListIterator <AppLnk> appit ( m_apps->children()); *appit; ++appit ) {
        AppLnk *l = *appit;

        int i = 0;
        for ( QStringList::Iterator it = types.begin(); it != types.end(); ++it ) {
            if ( l->type() == *it ) {
                QListViewItem *sub = new QListViewItem ( typeitem [i], l->name(), QString ( "QPE/Application/" ) + l->exec(), "raise()" );
                sub->setPixmap ( 0, l->pixmap());
            }
            i++;
        }
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:26,代码来源:buttonutils.cpp

示例3: load

void CustomTemplates::load()
{
  QStringList list = GlobalSettings::self()->customTemplates();
  for ( QStringList::iterator it = list.begin(); it != list.end(); ++it ) {
    CTemplates t(*it);
    // QString typeStr = indexToType( t.type() );
    QString typeStr;
    KShortcut shortcut( t.shortcut() );
    CustomTemplateItem *vitem =
      new CustomTemplateItem( *it, t.content(),
        shortcut,
        static_cast<Type>( t.type() ) );
    mItemList.insert( *it, vitem );
    QListViewItem *item = new QListViewItem( mList, typeStr, *it, t.content() );
    switch ( t.type() ) {
    case TReply:
      item->setPixmap( 0, mReplyPix );
      break;
    case TReplyAll:
      item->setPixmap( 0, mReplyAllPix );
      break;
    case TForward:
      item->setPixmap( 0, mForwardPix );
      break;
    default:
      item->setPixmap( 0, QPixmap() );
      item->setText( 0, indexToType( t.type() ) );
      break;
    };
  }
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: addDetails

void EstateDetails::addDetails()
{
	if (m_estate)
	{
		QListViewItem *infoText = 0;

		// Price
		if (m_estate->price())
		{
			infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Price: %1").arg(m_estate->price()));
			infoText->setPixmap(0, QPixmap(SmallIcon("info")));
		}

		// Owner, houses, isMortgaged
		if (m_estate && m_estate->canBeOwned())
		{
			infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Owner: %1").arg(m_estate->owner() ? m_estate->owner()->name() : i18n("unowned")));
			infoText->setPixmap(0, QPixmap(SmallIcon("info")));

			if (m_estate->isOwned())
			{
				infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Houses: %1").arg(m_estate->houses()));
				infoText->setPixmap(0, QPixmap(SmallIcon("info")));

				infoText = new QListViewItem(m_infoListView, m_infoListView->lastItem(), i18n("Mortgaged: %1").arg(m_estate->isMortgaged() ? i18n("Yes") : i18n("No")));
				infoText->setPixmap(0, QPixmap(SmallIcon("info")));
			}
		}
	}
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例5: draw_event_list

void oprof_start::draw_event_list()
{
	QListViewItem * cur;
	for (cur = events_list->firstChild(); cur; cur = cur->nextSibling()) {
		if (is_selectable_event(cur))
			cur->setPixmap(0, *green_pixmap);
		else
			cur->setPixmap(0, *red_pixmap);
	}
}
开发者ID:OPSF,项目名称:uClinux,代码行数:10,代码来源:oprof_start.cpp

示例6: insertVersionItems

/**
 * Insert package version items into the view (being children of a package
 * item).
 *
 * @param packageItem  The parent item whose version items should be created.
 */
void PakooPackageListView::insertVersionItems( QListViewItem* packageItem )
{
	if( packageItem->depth() != 1 ) // not a package item
		return;

	QListViewItem* categoryItem = packageItem->parent();

	const QString& categoryString = categoryItem->text(0);
	int pos = categoryString.find('-');
	Package* package = portageTree->package(
		categoryString.left(pos),  // category
		categoryString.mid(pos+1), // subcategory
		packageItem->text(0)       // package name
	);

	// get description, maskedness and Co.
	if( packageScanner->running() ) {
		packageScanner->abort();
		packageScanner->wait();
	}
	packageScanner->scanPackage( package );
	this->displayPackageDetails( package );

	PackageViewPackage& pkg =
		categories[categoryString].packageItems[package->name];

	if( pkg.hasVersions == true )
		return;
	else
		pkg.hasVersions = true;


	QListViewItem* versionItem;

	// create version subnodes
	PackageVersionMap* versions = package->versionMap();
	PackageVersionMap::iterator versionIteratorEnd = versions->end();

	for( PackageVersionMap::iterator versionIterator = versions->begin();
	     versionIterator != versionIteratorEnd; ++versionIterator )
	{
		versionItem = new KListViewItem(
			packageItem, (*versionIterator).version );

		if( (*versionIterator).installed == true ) {
			versionItem->setPixmap( 0, pxVersionItemInstalled );
		}
		else if( (*versionIterator).stability(arch) != PackageVersion::Stable ){
			versionItem->setPixmap( 0, pxVersionItemNotAvailable );
		}
		else {
			versionItem->setPixmap( 0, pxVersionItem );
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:61,代码来源:packagelistview.cpp

示例7: insertVersionItems

/**
 * Insert package version items into the view (being children of a package
 * item).
 *
 * @param packageItem  The parent item whose version items should be created.
 */
void PackageListView::insertVersionItems( QListViewItem* packageItem )
{
	if( packageItem->depth() != 1 ) // not a package item
		return;

	QListViewItem* categoryItem = packageItem->parent();
	PackageCategory* category = m_backend->createPackageCategory();
	category->loadFromUniqueName( categoryItem->text(0) );

	Package* package = m_shownPackages->package(
		category,
		packageItem->text(0) // package name
	);

	// get description, maskedness and Co.
	m_packageLoader->setPackage( package );
	m_packageLoader->perform();
	this->displayPackageDetails( package );

	PackageViewCategory& pvcategory =
		m_categories[package->category()->uniqueName()];
	PackageViewPackage& pkg =
		pvcategory.packageItems[package->name()];

	if( pkg.containsVersions == true )
		return;
	else
		pkg.containsVersions = true;


	QListViewItem* versionItem;

	// create version subnodes
	Package::versioniterator versionIteratorEnd = package->versionEnd();

	for( Package::versioniterator versionIterator = package->versionBegin();
	     versionIterator != versionIteratorEnd; ++versionIterator )
	{
		versionItem = new KListViewItem(
			packageItem, (*versionIterator)->version() );

		if( (*versionIterator)->isInstalled() ) {
			versionItem->setPixmap( 0, pxVersionItemInstalled );
		}
		else if( (*versionIterator)->isAvailable() == false ){
			versionItem->setPixmap( 0, pxVersionItemNotAvailable );
		}
		else {
			versionItem->setPixmap( 0, pxVersionItem );
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:58,代码来源:packagelistview.cpp

示例8: addGroup

void RosterBox::addGroup( QString name, bool open )
{
	QListViewItem *group = new QListViewItem( this, name, "group", name );
	
	if( open )
		group->setPixmap( 0, takePixmap( "group_open" ) );
	else
		group->setPixmap( 0, takePixmap( "group_closed" ) );
	openGroups[ name ] = open;
	group->setOpen( open );
	
	groupList.append( group );
}
开发者ID:BackupTheBerlios,项目名称:qtlen,代码行数:13,代码来源:roster_box.cpp

示例9: fillTree

void NewDevice::fillTree()
{
    QListViewItem* parent = NULL;
    QListViewItem* newItem = NULL;

    QPtrList <DeviceClass> *dl = _app->deviceClassList();

    QPixmap pm(PIXMAPS + QString("/dmx.xpm"));

    QString config;
    bool treeOpen = false;
    if (_app->settings()->get("NewDeviceTreeOpen", config) != -1 &&
            config == Settings::trueValue())
    {
        treeOpen = true;
    }
    else
    {
        treeOpen = false;
    }

    m_tree->clear();

    for (DeviceClass* dc = dl->first(); dc != NULL; dc = dl->next())
    {
        bool alreadyAdded = false;

        for (QListViewItem* i = m_tree->firstChild();
                i != NULL; i = i->nextSibling())
        {
            if (i->text(0) == dc->manufacturer())
            {
                alreadyAdded = true;
                parent = i;
                break;
            }
        }

        if (alreadyAdded == false)
        {
            parent = new QListViewItem(m_tree, dc->manufacturer());
            parent->setOpen(treeOpen);
        }

        parent->setPixmap(0, QPixmap(PIXMAPS + QString("/global.xpm")));

        newItem = new QListViewItem(parent, dc->model());
        newItem->setPixmap(0, pm);
        newItem->setText(1,dc->type());
    }
}
开发者ID:speakman,项目名称:qlc,代码行数:51,代码来源:newdevice.cpp

示例10: slotNewAction

void ActionConfigDialog::slotNewAction()
{
  QDomDocument doc;
  QDomElement el = doc.createElement("action");
  el.setAttribute( "name", "user_"+KApplication::randomString(10) );
  el.setAttribute( "icon", "ball" );

  currentAction = new TagAction(&el, m_mainWindow);

  //add the actions to every toolbar xmlguiclient
  QDictIterator<ToolbarEntry> it(m_toolbarList);
  while (it.current())
  {
    it.current()->guiClient->actionCollection()->insert(currentAction);
    ++it;
  }

  selectedShortcut = KShortcut();
  static_cast<TagAction*>(currentAction)->setModified(true);
  QListViewItem *currentItem = actionTreeView->currentItem();
  QListViewItem *item = new KListViewItem(allActionsItem);
  QString actionText = QString("Action_%1").arg(m_mainWindow->actionCollection()->count());
  currentAction->setText(actionText);
  item->setText(2, currentAction->name());
  item->setText(0, actionText);
  item->setPixmap(0, SmallIcon("ball"));
  allActionsItem->sortChildItems(0, true);
  if (currentItem->parent() && currentItem->parent() == allActionsItem)
  {
     actionTreeView->setCurrentItem(item);
  } else
  {
    QListViewItem *parentItem = currentItem->parent();
    if (!parentItem)
      parentItem = currentItem;

    item = new KListViewItem(parentItem, currentItem);
    item->setText(0, actionText);
    item->setText(2, currentAction->name());
    item->setPixmap(0, SmallIcon("ball"));
    actionTreeView->setCurrentItem(item);
    if (parentItem != allActionsItem)
    {
      toolbarListBox->insertItem(parentItem->text(0));
      toolbarListBox->setCurrentItem(0);
      toolbarListBox->setSelected(0, true);
    }
  }
  actionTreeView->ensureItemVisible(item);
  buttonApply->setEnabled(true);
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:51,代码来源:actionconfigdialog.cpp

示例11: update

void QOpenFileDialog::update(const std::string &selectedNodeName) {
	myStateLine->setText(QString::fromLocal8Bit(state()->name().c_str()));

	myListView->clear();

	QListViewItem *item = 0;
	QListViewItem *selectedItem = 0;

	const std::vector<ZLTreeNodePtr> &subnodes = state()->subnodes();
	for (std::vector<ZLTreeNodePtr>::const_iterator it = subnodes.begin(); it != subnodes.end(); ++it) {
	 	item = new QOpenFileDialogItem(myListView, item, *it);
		item->setPixmap(0, getPixmap(*it));
		if ((*it)->name() == selectedNodeName) {
			selectedItem = item;
		}
	}

	if (selectedItem == 0) {
		selectedItem = myListView->firstChild();
	}
	myListView->setSelected(selectedItem, true);
	if (selectedItem != myListView->firstChild()) {
		myListView->ensureItemVisible(selectedItem);
	}
}
开发者ID:xufooo,项目名称:fbreader-e2-test,代码行数:25,代码来源:QOpenFileDialog.cpp

示例12: addWidget

void UserInfo::addWidget(PAGEPROC *proc, int index, const QString &name, const char *icon, int param)
{
    QListViewItem *item = new QListViewItem(itemMain, name, QString::number(index));
    item->setPixmap(0, Pict(icon));
    item->setText(3, QString::number((unsigned)proc));
    item->setText(4, QString::number(param));
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例13: insertActions

void ButtonUtils::insertActions ( QListViewItem *here )
{
    for ( const predef_qcop *p = predef; p->m_text; p++ ) {
        QListViewItem *item = new QListViewItem ( here, qApp->translate ( "ButtonSettings", p->m_text ), p->m_channel, p->m_function );
        item->setPixmap ( 0, Opie::Core::OResource::loadPixmap( p->m_pixmap, Opie::Core::OResource::SmallIcon ) );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:7,代码来源:buttonutils.cpp

示例14: displaySlots

void EditFunctions::displaySlots( bool justSlots )
{
    functionIds.clear();
    functionListView->clear();
    for ( QValueList<FunctItem>::Iterator it = functList.begin(); it != functList.end(); ++it ) {
        if ( (*it).type == "function" && justSlots )
            continue;
        QListViewItem *i = new QListViewItem( functionListView );
        functionIds.insert( i, (*it).id );
        i->setPixmap( 0, QPixmap::fromMimeSource( "designer_editslots.png" ) );
        i->setText( 0, (*it).newName );
        i->setText( 1, (*it).retTyp );
        i->setText( 2, (*it).spec );
        i->setText( 3, (*it).access  );
        i->setText( 4, (*it).type );

        if ( (*it).type == "slot" ) {
            if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).newName ).latin1() ) )
                i->setText( 5, tr( "Yes" ) );
            else
                i->setText( 5, tr( "No" ) );
        } else {
            i->setText( 5, "---" );
        }
    }

    if ( functionListView->firstChild() )
        functionListView->setSelected( functionListView->firstChild(), TRUE );
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:29,代码来源:editfunctionsimpl.cpp

示例15: processShares

void SmbView::processShares()
{
    QStringList lines = QStringList::split('\n', m_buffer, true);
    QString line;
    uint index(0);
    for(; index < lines.count(); index++)
        if(lines[index].stripWhiteSpace().startsWith("Sharename"))
            break;
    index += 2;
    while(index < lines.count())
    {
        line = lines[index++].stripWhiteSpace();
        if(line.isEmpty())
            break;
        else if(line.startsWith("Error returning"))
        {
            KMessageBox::error(this, line);
            break;
        }
        QString typestr(line.mid(15, 10).stripWhiteSpace());
        // QStringList	words = QStringList::split(' ',line,false);
        // if (words[1] == "Printer")
        if(typestr == "Printer")
        {
            QString comm(line.mid(25).stripWhiteSpace()), sharen(line.mid(0, 15).stripWhiteSpace());
            // for (uint i=2; i<words.count(); i++)
            //	comm += (words[i]+" ");
            // QListViewItem	*item = new QListViewItem(m_current,words[0],comm);
            QListViewItem *item = new QListViewItem(m_current, sharen, comm);
            item->setPixmap(0, SmallIcon("kdeprint_printer"));
        }
    }
}
开发者ID:,项目名称:,代码行数:33,代码来源:


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