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


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

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


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

示例1: setRoot

/**
 * Sets a new root item for the tree.
 * @param	sFunc	The name of the function to serve as root
 */
void TreeWidget::setRoot(const QString& sFunc)
{
	QListViewItem* pRoot;
	
	// Remove the current root, if any
	if ((pRoot = firstChild()) != NULL)
		delete pRoot;
	
	// Create a new root item
	pRoot = new QListViewItem(this, sFunc);
	pRoot->setExpandable(true);
}
开发者ID:fredollinger,项目名称:kscope,代码行数:16,代码来源:treewidget.cpp

示例2: processGroups

void SmbView::processGroups()
{
    QStringList grps = QStringList::split('\n', m_buffer, false);
    clear();
    for(QStringList::ConstIterator it = grps.begin(); it != grps.end(); ++it)
    {
        int p = (*it).find("<1d>");
        if(p == -1)
            continue;
        QListViewItem *item = new QListViewItem(this, (*it).left(p).stripWhiteSpace());
        item->setExpandable(true);
        item->setPixmap(0, SmallIcon("network"));
    }
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例3: addRecord

/**
 * Creates a new tree item showing a query result record.
 * @param	sFunc	The name of the function
 * @param	sFile	The file path
 * @param	sLine	The line number in the above file
 * @param	sText	The line's text
 * @param	pParent	The parent for the new item
 */
void TreeWidget::addRecord(const QString& sFunc, const QString& sFile,
	const QString& sLine, const QString& sText, QListViewItem* pParent)
{
	QListViewItem* pItem;
	
	pItem = new QListViewItem(pParent, m_pLastItem);
	pItem->setText(0, sFunc);
	pItem->setText(1, sFile);
	pItem->setText(2, sLine);
	pItem->setText(3, sText);
	
	pItem->setExpandable(true);
	m_pLastItem = pItem;
}
开发者ID:fredollinger,项目名称:kscope,代码行数:22,代码来源:treewidget.cpp

示例4: processServers

void SmbView::processServers()
{
    QStringList lines = QStringList::split('\n', m_buffer, true);
    QString line;
    uint index(0);
    for(; index < lines.count(); index++)
        if(lines[index].stripWhiteSpace().startsWith("Server"))
            break;
    index += 2;
    while(index < lines.count())
    {
        line = lines[index++].stripWhiteSpace();
        if(line.isEmpty())
            break;
        QStringList words = QStringList::split(' ', line, false);
        QListViewItem *item = new QListViewItem(m_current, words[0]);
        item->setExpandable(true);
        item->setPixmap(0, SmallIcon("kdeprint_computer"));
    }
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例5: addDerivedClassifier

void RefactoringAssistant::addDerivedClassifier()
{
    QListViewItem *item = selectedItem();
    if(!item)
    {
        kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
        <<"called with no item selected"<<endl;
        return;
    }
    UMLObject *obj = findUMLObject( item );
    if( !dynamic_cast<UMLClassifier*>(obj) )
    {
        kWarning()<<"RefactoringAssistant::addDerivedClassifier() "
        <<"called for a non-classifier object"<<endl;
        return;
    }

    //classes have classes and interfaces interfaces as super/derived classifiers
    Uml::Object_Type t = obj->getBaseType();
    UMLClassifier *derived = static_cast<UMLClassifier*>(Object_Factory::createUMLObject(t));
    if(!derived)
        return;
    m_doc->createUMLAssociation( derived, obj, Uml::at_Generalization );

    //////////////////////   Manually add the classifier to the assitant - would be nicer to do it with
    /////////////////////    a signal, like operations and attributes
    QListViewItem *derivedFolder = item->firstChild();
    while( derivedFolder->text(0) != i18n("Derived Classifiers") )
        derivedFolder = derivedFolder->nextSibling();
    if(!derivedFolder)
    {
        kWarning()<<"Cannot find Derived Folder"<<endl;
        return;
    }
    item = new KListViewItem( derivedFolder, derived->getName() );
    item->setPixmap(0,m_pixmaps.Subclass);
    item->setExpandable( true );
    m_umlObjectMap[item] = derived;
    addClassifier( derived, item, false, true, true);
    /////////////////////////
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:41,代码来源:refactoringassistant.cpp

示例6: insertPackageItem

/**
 * Insert a package item into the view.
 * This function does not insert version child items.
 *
 * @param parent  Parent item of the package one. This will most likely be
 *                a category item.
 * @param package  The package whose data is used for creating the item.
 */
void PackageListView::insertPackageItem( QListViewItem* parent,
                                         Package& package )
{
	// create the package item
	QListViewItem* packageItem = new KListViewItem( parent, package.name() );
	packageItem->setExpandable( true );

	PackageViewPackage& pkg =
		m_categories[parent->text(0)].packageItems[package.name()];
	pkg.item = packageItem;
	pkg.containsVersions = false;
	pkg.hasDetails = false;

	if( package.containsInstalledVersion() ) {
		packageItem->setPixmap( 0, pxPackageItemInstalled );
		pkg.installed = true;
		m_installedPackageCount++;
	}
	else {
		packageItem->setPixmap( 0, pxPackageItem );
	}
	m_totalPackageCount++;
}
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:31,代码来源:packagelistview.cpp

示例7: eWidget


//.........这里部分代码省略.........
            return e->param();
        }
    }
    if (e->type() == EventDiscoItem){
        if (!m_bInProcess)
            return NULL;
        DiscoItem *item = (DiscoItem*)(e->param());
        QListViewItem *it = findItem(COL_ID_DISCO_ITEMS, item->id.c_str());
        if (it){
            if (item->jid.empty()){
                it->setText(COL_ID_DISCO_ITEMS, "");
                if (it != m_list->firstChild()){
                    checkDone();
                    adjustColumn(it);
                    return e->param();
                }
                QString err;
                if (!item->name.empty()){
                    err = QString::fromUtf8(item->name.c_str());
                }else if (!item->node.empty()){
                    err = i18n("Error %1") .arg(atol(item->node.c_str()));
                }
                if (!err.isEmpty()){
					unsigned mode = atol(it->text(COL_MODE).latin1());
					if (((mode & BROWSE_BROWSE) == 0) || (it->text(COL_ID_BROWSE).isEmpty() & m_bError))
                        stop(err);
                    m_bError = true;
                }
                checkDone();
                adjustColumn(it);
                return e->param();
            }
            if (it->firstChild() == NULL){
                it->setExpandable(true);
						if ((it == m_list->firstChild()) || (it == m_list->currentItem()))
							it->setOpen(true);
            }
            QListViewItem *i;
            for (i = it->firstChild(); i; i = i->nextSibling()){
                if ((i->text(COL_JID) == QString::fromUtf8(item->jid.c_str())) &&
                        (i->text(COL_NODE) == QString::fromUtf8(item->node.c_str())))
                    return e->param();
            }
            i = new QListViewItem(it);
            i->setText(COL_JID, QString::fromUtf8(item->jid.c_str()));
            i->setText(COL_NAME, item->name.empty() ? QString::fromUtf8(item->jid.c_str()) : QString::fromUtf8(item->name.c_str()));
            i->setText(COL_NODE, QString::fromUtf8(item->node.c_str()));
            int mode = 0;
            if (m_client->getBrowseType() & BROWSE_DISCO){
                i->setText(COL_ID_DISCO_INFO, m_client->discoInfo(item->jid.c_str(), item->node.c_str()).c_str());
                mode |= BROWSE_INFO;
            }
            i->setText(COL_MODE, QString::number(mode));
			if (m_client->getAllLevels())
				loadItem(i);
            return e->param();
        }
        it = findItem(COL_ID_DISCO_INFO, item->id.c_str());
        if (it){
            if (item->jid.empty()){
                it->setText(COL_ID_DISCO_INFO, "");
                checkDone();
                adjustColumn(it);
                return e->param();
            }
            if (it->text(COL_NAME) == it->text(COL_JID))
开发者ID:,项目名称:,代码行数:67,代码来源:

示例8: refreshView

/**
 * Clear and refill the ListView with those package items that
 * are defined by the list of all packages and the PackageSelector.
 */
void PackageListView::refreshView()
{
	abortLoadingPackageDetails();

	//if( m_parallelScanning == true )
	//{
		//TODO: bring back?
		// also start a thread for scanning the installed packages,
		// because they are more important and need hasUpdates first.
		//packageInstalledScanner->startScanningCategory(
		//	this, tree, categoryName, subcategoryName
		//);
	//}

	// reset everything
	m_categories.clear();
	this->clear(); emit cleared();
	m_loadedPackageCount = 0;
	m_installedPackageCount = 0;
	m_totalPackageCount = 0;

	// Get the list of shown packages
	m_packageSelector->setSourceList( m_allPackages );
	m_packageSelector->setDestinationList( m_shownPackages );
	if( m_packageSelector->perform() == IJob::Failure ) {
		kdDebug() << i18n( "PackageListView debug output",
			"PackageListView::refreshView(): "
			"Failed to select shown packages" )
			<< endl;
		return;
	}

	// scan the package descriptions (in an extra thread)
	m_multiplePackageLoader->setPackageList( m_shownPackages );
	m_multiplePackageLoader->start();


	// Insert packages under their right category in the ListView.
	// If the category doesn't exist yet, then a check ensures that
	// it is created before insertPackageItem() creates the package item.

	QListViewItem *catItem;
	QString categoryName, uniqueCategoryName;
	PackageList::iterator packageIteratorEnd = m_shownPackages->end();

	for( PackageList::iterator packageIterator = m_shownPackages->begin();
	     packageIterator != packageIteratorEnd; ++packageIterator )
	{
		//TODO: We want user visible names in categoryName.
		//      See emitSelectionChanged().
		categoryName = (*packageIterator)->category()->uniqueName();
		uniqueCategoryName = (*packageIterator)->category()->uniqueName();

		if( m_categories.contains(uniqueCategoryName) == false )
		{
			catItem = new KListViewItem( this, categoryName );
			catItem->setExpandable( true );
			catItem->setOpen( true );
			catItem->setPixmap( 0, pxCategoryItem );
			m_categories[uniqueCategoryName].item = catItem;
		}
		insertPackageItem(
			m_categories[uniqueCategoryName].item, *(*packageIterator)
		);
	}

	emit contentsChanged();

} // end of refreshView(...)
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:73,代码来源:packagelistview.cpp

示例9: addClassifier

void RefactoringAssistant::addClassifier( UMLClassifier *classifier, QListViewItem *parent, bool addSuper, bool addSub, bool recurse)
{
    QListViewItem *classifierItem, *item;
    if( parent )
    {
        classifierItem = parent;
    }
    else
    {
        classifierItem= new KListViewItem( this, classifier->getName() );
        m_umlObjectMap[classifierItem] = classifier;
    }

    connect( classifier, SIGNAL( modified() ), this, SLOT( umlObjectModified() ) );

    UMLClassifier *klass = dynamic_cast<UMLClassifier*>(classifier);
    if( klass )
    {// only Classes have attributes...
        connect( classifier, SIGNAL(attributeAdded(UMLClassifierListItem*)),
                 this, SLOT(attributeAdded(UMLClassifierListItem*)));
        connect( classifier, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
                 this, SLOT(attributeRemoved(UMLClassifierListItem*)));

        QListViewItem *attsFolder = new KListViewItem( classifierItem, i18n("Attributes"), "attributes" );
        attsFolder->setPixmap(0,SmallIcon("folder_green_open"));
        attsFolder->setExpandable( true );
        UMLAttributeList atts = klass->getAttributeList();
        for( UMLAttribute *att = atts.first(); att; att = atts.next() )
        {
            attributeAdded( att );
        }

    }

    // add operations
    connect( classifier, SIGNAL(operationAdded(UMLClassifierListItem*)),
             this, SLOT(operationAdded(UMLClassifierListItem*)));
    connect( classifier, SIGNAL(operationRemoved(UMLClassifierListItem*)),
             this, SLOT(operationRemoved(UMLClassifierListItem*)));

    QListViewItem *opsFolder = new KListViewItem( classifierItem, i18n("Operations"), "operations" );
    opsFolder->setPixmap(0,SmallIcon("folder_blue_open"));
    opsFolder->setExpandable( true );
    UMLOperationList ops(classifier->getOpList());
    for( UMLOperation *op = ops.first(); op ; op = ops.next() )
    {
        operationAdded( op );
    }

    //if add parents
    if(addSuper)
    {
        QListViewItem *superFolder = new KListViewItem( classifierItem, i18n("Base Classifiers") );
        superFolder->setExpandable( true );
        UMLClassifierList super = classifier->findSuperClassConcepts();
        for( UMLClassifier *cl = super.first(); cl ; cl = super.next() )
        {
            item = new KListViewItem( superFolder, cl->getName() );
            item->setPixmap(0,m_pixmaps.Generalization);
            item->setExpandable( true );
            m_umlObjectMap[item] = cl;
            if( recurse )
            {
                addClassifier( cl, item, true, false, true);
            }

        }
    }
    if(addSub)
    {
        //add derived classifiers
        QListViewItem *derivedFolder = new KListViewItem( classifierItem, i18n("Derived Classifiers") );
        derivedFolder->setExpandable( true );
        UMLClassifierList derived = classifier->findSubClassConcepts();
        for( UMLClassifier *d = derived.first(); d ; d = derived.next() )
        {
            item = new KListViewItem( derivedFolder, d->getName() );
            item->setPixmap(0,m_pixmaps.Subclass);
            item->setExpandable( true );
            m_umlObjectMap[item] = d;
            if( recurse )
            {
                addClassifier( d, item, false, true, true);
            }

        }
    }
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:88,代码来源:refactoringassistant.cpp

示例10: displayPackages

/**
 * Show packages from the given PortageTree object inside this ListView.
 * The packages can be filtered by category and subcategory, so that only
 * a subset of the packages in the tree are displayed.
 *
 * @param tree  The tree object containing the packages that will be shown.
 * @param settings  A Settings object containing configuration properties.
 * @param categoryName  Only show packages from this category. QString::null
 *                      means all packages will be shown (without filter).
 * @param subcategoryName  Only show packages from this subcategory.
 *                         This is only used if the categoryName filter is
 *                         also set. QString::null means that the packages
 *                         won't be filtered by subcategory.
 */
void PakooPackageListView::displayPackages(
	PortageTree* tree, PortageSettings* settings,
	const QString& categoryName, const QString& subcategoryName )
{
	if( tree == NULL )
		return;
	else
		portageTree = tree;

	updateSettings( settings );

	abortLoadingPackageDetails();

	// scan the package descriptions (in an extra thread)
	packageCategoryScanner->startScanningCategory(
		this, tree, categoryName, subcategoryName
	);

	if( parallelScanning == true )
	{
		// also start a thread for scanning the installed packages,
		// because they are more important and need hasUpdates first.
		packageInstalledScanner->startScanningCategory(
			this, tree, categoryName, subcategoryName
		);
	}

	// reset everything
	categories.clear();
	this->clear(); emit cleared();
	loadedPackages = 0;
	installedPackages = 0;
	totalPackages = 0;

	category = categoryName;
	subcategory = subcategoryName;
	QString fullCategoryName;
	QListViewItem *catItem;

	// Insert packages under their right category in the ListView.
	PackageMap* packages = tree->packageMap();
	PackageMap::iterator packageIteratorEnd = packages->end();

	if( categoryName.isNull() ) // no category filter at all, process all
	{
		// Iterate through all packages
		for( PackageMap::iterator packageIterator = packages->begin();
		     packageIterator != packageIteratorEnd; ++packageIterator )
		{
			fullCategoryName = (*packageIterator).category + "-"
			                    + (*packageIterator).subcategory;

			if( categories.contains(fullCategoryName) == false )
			{
				catItem = new KListViewItem( this, fullCategoryName );
				catItem->setExpandable( true );
				catItem->setOpen( true );
				catItem->setPixmap( 0, pxCategoryItem );
				categories[fullCategoryName].item = catItem;
			}
			insertPackageItem(
				categories[fullCategoryName].item, *packageIterator
			);
		}
	}
	else // at least the main-category filter is set
	{
		// Iterate through all packages
		for( PackageMap::iterator packageIterator = packages->begin();
			 packageIterator != packageIteratorEnd; ++packageIterator )
		{
			// Only process categories that equal the given filter category.
			if( categoryName != (*packageIterator).category )
				continue;

			// Only process packages if no subcategory filter is set,
			// or if the current package's subcategory equals the given one.
			if( subcategoryName.isNull()
				|| (*packageIterator).subcategory == subcategoryName )
			{
				fullCategoryName = (*packageIterator).category + "-"
					+ (*packageIterator).subcategory;

				if( categories.contains(fullCategoryName) == false ) {
					catItem = new KListViewItem( this, fullCategoryName );
					catItem->setExpandable( true );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:pakoo-svn,代码行数:101,代码来源:packagelistview.cpp


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