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


C++ QTreeWidgetItem::setSelected方法代码示例

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


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

示例1: selectWidget

void WidgetTreeWidget::selectWidget(QWidget *w, KFormDesigner::Form::WidgetSelectionFlags flags)
{
    if (!d->selectWidget_enabled)
        return;
    blockSignals(true); // to avoid recursion

    if (!w) {
        clearSelection();
        blockSignals(false);
        return;
    }

    if (selectedItems().count() == 0) {
        flags |= Form::ReplacePreviousSelection;
    }

    if ((flags & Form::ReplacePreviousSelection))
        clearSelection();

    QTreeWidgetItem *item = findItem(w->objectName());
    if ((flags & Form::ReplacePreviousSelection)) {
        setCurrentItem(item);
        item->setSelected(true);
    } else {
        item->setSelected(true);
    }

    blockSignals(false);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:29,代码来源:WidgetTreeWidget.cpp

示例2: update

void KoRdfSemanticTreePrivate::update(KoDocumentRdf *rdf, QSharedPointer<Soprano::Model> model)
{
    QSet<QString> selectedPeople;
    QSet<QString> selectedEvents;
    QSet<QString> selectedLocations;

    buildSelectedSet(m_peopleItem, selectedPeople);
    buildSelectedSet(m_eventsItem, selectedEvents);
    buildSelectedSet(m_locationsItem, selectedLocations);
    clear(m_peopleItem);
    clear(m_eventsItem);
    clear(m_locationsItem);
    m_peopleItem->setSelected(false);
    m_eventsItem->setSelected(false);
    m_locationsItem->setSelected(false);
    m_foafs.clear();
    m_cals.clear();
    m_locations.clear();

    // people
    m_foafs = rdf->foaf(model);
    foreach (hKoRdfFoaF foaf, m_foafs) {
        KoRdfSemanticTreeWidgetItem *item = foaf->createQTreeWidgetItem(m_peopleItem);
        if (selectedPeople.contains(item->semanticItem()->name())) {
            item->setSelected(true);
        }
    }
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:27,代码来源:KoRdfSemanticTree.cpp

示例3: showActiveSatellites

void FormEphem::showActiveSatellites(void)
{

  QStringList tlelist = sats->GetActiveSatList();
  QStringList::Iterator it2 = tlelist.begin();
  QString str1, str2, str3, str4, str5, str6;
  int nRes, st;
  bool ok;

  QTreeWidgetItem *item;

  ui->satlisttreewidget->clear();

  while( it2 != tlelist.end() )
  {
      qDebug() << (*it2);
    st=0;
    nRes = (*it2).indexOf( ",", st);
    str1 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str2 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str3 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str4 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    nRes = (*it2).indexOf( ",", st);
    str5 = (*it2).mid(st, nRes-st);
    st=nRes+1;
    str6 = (*it2).mid(st);

    QStringList actsat;
    actsat << str1.toLatin1() << str2.toLatin1() << str3.toLatin1() << str4.toLatin1() << str5.toLatin1() << str6.toLatin1();
    item = new QTreeWidgetItem( ui->satlisttreewidget, actsat, 0  );

    if(str2.toInt(&ok, 10) == sats->GetSelectedSat())
        item->setSelected(true);
    else
        item->setSelected(false);

    ++it2;
  }


}
开发者ID:Sammalou,项目名称:EUMETCastView,代码行数:48,代码来源:formephem.cpp

示例4: moveDownClicked

    void moveDownClicked()
    {
        QList<QTreeWidgetItem*> selectedPaths = m_treeView->selectedItems();

        if( selectedPaths.isEmpty() )
        {
            return;
        }
        else if( m_treeView->indexOfTopLevelItem(selectedPaths.last()) == m_treeView->topLevelItemCount() -1)
        {
            return;
        }
        else
        {
            // Retrieves the value that is before the first selected row.
            int index = m_treeView->indexOfTopLevelItem( selectedPaths.last() );
            QTreeWidgetItem*	newRow	= m_treeView->takeTopLevelItem(index);
            newRow->setFlags(newRow->flags() | Qt::ItemIsEditable);
            m_treeView->insertTopLevelItem( index + 1, newRow);

            newRow->setSelected(true);
            m_treeView->topLevelItem(index)->setSelected(false);
            rebuildRowIndexes();

            // Sends a change notification.
            Q_EMIT signalChanged();
        }
    }
开发者ID:npapier,项目名称:vgsdk,代码行数:28,代码来源:MultiFieldEditor.hpp

示例5: moveUpClicked

    void moveUpClicked()
    {
        QList<QTreeWidgetItem*> selectedPaths = m_treeView->selectedItems();

        if( selectedPaths.isEmpty() )
        {
            return;
        }
        else if( m_treeView->indexOfTopLevelItem(selectedPaths.last()) == 0 )
        {
            return;
        }
        else
        {
            int index = m_treeView->indexOfTopLevelItem( selectedPaths.last() );
            QTreeWidgetItem*	newRow	= m_treeView->takeTopLevelItem(index);
            if(index < m_treeView->topLevelItemCount())
            {
                m_treeView->topLevelItem(index)->setSelected(false);
            }
            else
            {
                m_treeView->topLevelItem(m_treeView->topLevelItemCount() - 1 )->setSelected(false);
            }
            newRow->setFlags(newRow->flags() | Qt::ItemIsEditable);
            m_treeView->insertTopLevelItem( index - 1, newRow);

            newRow->setSelected(true);
            rebuildRowIndexes();

            // Sends a change notification.
            Q_EMIT signalChanged();
        }
    }
开发者ID:npapier,项目名称:vgsdk,代码行数:34,代码来源:MultiFieldEditor.hpp

示例6: slotFunctionRemoved

void FunctionManager::slotFunctionRemoved(t_function_id id)
{
	QTreeWidgetItem* item;

	// The function manager has its own routines for functions that are
	// removed with it.
	if (m_blockRemoveFunctionSignal == true)
		return;

	item = getItem(id, m_functionTree);
	if (item != NULL)
	{
		if (item->isSelected() == true)
		{
			QTreeWidgetItem* nextItem;

			// Try to select the closest neighbour
			if (m_functionTree->itemAbove(item) != NULL)
				nextItem = m_functionTree->itemAbove(item);
			else
				nextItem = m_functionTree->itemBelow(item);
	  
			if (nextItem != NULL)
				nextItem->setSelected(true);
		}

		delete item;
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:29,代码来源:functionmanager.cpp

示例7: lineEditSearchTextChanged

void GameDosBoxDialog::lineEditSearchTextChanged( const QString &txt )
{
	treeWidgetDosboxGames->setSelectionMode( QAbstractItemView::MultiSelection );

	if( comboBoxSearch->currentIndex() <= -1 )
	{
		QMessageBox::information( this, "Gamedatabase", tr("Please select a column for search.") );
		return;
	}

	if( txt.isNull() || txt.isEmpty() )
		return;

	for( int a = 0; a < treeWidgetDosboxGames->topLevelItemCount(); a++ )
	{
		qApp->processEvents();
		treeWidgetDosboxGames->topLevelItem( a )->setSelected( false );
	}

	QList<QTreeWidgetItem *> search( treeWidgetDosboxGames->findItems( txt, Qt::MatchCaseSensitive | Qt::MatchContains, comboBoxSearch->currentIndex() ) );
	if( !search.isEmpty() && !(search.size() <= 0) )
	{
		for( int i = 0; i < search.size(); i++ )
		{
			QTreeWidgetItem *item = search.value( i );
			item->setSelected( true );
		}
	}		
}
开发者ID:BackupTheBerlios,项目名称:dboxfe-svn,代码行数:29,代码来源:dboxfegdb_dosbox.cpp

示例8: OnSelectedControlNodesChanged

void HierarchyTreeWidget::OnSelectedControlNodesChanged(const HierarchyTreeController::SELECTEDCONTROLNODES &selectedControls)
{
	if (internalSelectionChanged)
		return;
	
	internalSelectionChanged = true;
	ResetSelection();
	
	TREEITEMS items = GetAllItems();
	for (HierarchyTreeController::SELECTEDCONTROLNODES::const_iterator iter = selectedControls.begin();
		 iter != selectedControls.end();
		 ++iter)
	{
		const HierarchyTreeControlNode* node = (*iter);
		TREEITEMS::iterator itemIter = items.find(node->GetId());
		if (itemIter != items.end())
		{
            QTreeWidgetItem* item = itemIter->second;
			item->setSelected(true);
			
			// Force show selected item
            QTreeWidgetItem* parentItem = item->parent();
            while (parentItem)
            {
                parentItem->setExpanded(true);
                parentItem = parentItem->parent();
            }
		}
	}

	internalSelectionChanged = false;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例9: SelectItemAndExpandTreeByEventName

void FMODSoundBrowser::SelectItemAndExpandTreeByEventName(const DAVA::String & eventName)
{
    DAVA::Vector<DAVA::String> tokens;
    DAVA::Split(eventName, "/", tokens);
    DAVA::int32 tokensCount = tokens.size();
    QTreeWidgetItem * currentItem = ui->treeWidget->invisibleRootItem();
    for(DAVA::int32 i = 0; i < tokensCount; i++)
    {
        QString currentToken = QString(tokens[i].c_str());
        DAVA::int32 childrenCount = currentItem->childCount();
        QTreeWidgetItem * findedItem = 0;
        for(DAVA::int32 k = 0; k < childrenCount; k++)
        {
            QTreeWidgetItem * currentChild = currentItem->child(k);
            if(currentChild->text(0) == currentToken)
            {
                findedItem = currentChild;
                findedItem->setExpanded(true);
                break;
            }
        }
        if(!findedItem)
            return;

        currentItem = findedItem;
    }
    currentItem->setSelected(true);
}
开发者ID:galek,项目名称:dava.framework,代码行数:28,代码来源:FMODSoundBrowser.cpp

示例10: addSubscriber

void MainWindow::addSubscriber()
{
    QTreeWidgetItemIterator it(ui->treeWidget);
    while (*it)
    {
        (*it)->setSelected(false);
        (*it)->setExpanded(false);
        ++it;
    }

    QTreeWidgetItem *sub = new QTreeWidgetItem(ui->treeWidget);
        sub->setText(0, QString("Brak identyfikatora #") + QString::number(ui->treeWidget->model()->rowCount()));
    QTreeWidgetItem *id = new QTreeWidgetItem(sub);
        id->setText(0, "#:");
        id->setText(1, QString::number(ui->treeWidget->model()->rowCount()));
    QTreeWidgetItem *mail = new QTreeWidgetItem(sub);
        mail->setText(0, "E-mail:");
        mail->setText(1, "brak");
    QTreeWidgetItem *phone = new QTreeWidgetItem(sub);
        phone->setText(0, "Telefon:");
        phone->setText(1, "brak");
    QTreeWidgetItem *notification = new QTreeWidgetItem(sub);
        notification->setText(0, "Typ powiadomienia:");
        notification->setText(1, "brak");

    sub->setSelected(true);
    sub->setExpanded(true);

    ui->treeWidget->insertTopLevelItem(0, sub);
    ui->treeWidget->scrollToBottom();

    selectedSubscriber = NULL;
}
开发者ID:AnomalyDetection2012,项目名称:AnomalyDetection2012PWR,代码行数:33,代码来源:mainwindow.cpp

示例11: AddControlItem

void HierarchyTreeWidget::AddControlItem(QTreeWidgetItem* parent, const EXPANDEDITEMS& selectedItems, const EXPANDEDITEMS& expandedItems, const HierarchyTreeNode::HIERARCHYTREENODESLIST& items)
{
	for (HierarchyTreeNode::HIERARCHYTREENODESLIST::const_iterator iter = items.begin();
		 iter != items.end();
		 ++iter)
	{
		const HierarchyTreeControlNode* controlNode = (const HierarchyTreeControlNode*)(*iter);
		
		QTreeWidgetItem* controlItem = new QTreeWidgetItem();
		controlItem->setData(ITEM_ID, controlNode->GetId());
		controlItem->setText(0, controlNode->GetName());

		Decorate(controlItem, controlNode->GetUIObject());

		parent->insertChild(parent->childCount(), controlItem);
		
		AddControlItem(controlItem, selectedItems, expandedItems, controlNode->GetChildNodes());
		
		if (expandedItems.find(controlNode->GetId()) != expandedItems.end())
			controlItem->setExpanded(true);
		if (selectedItems.find(controlNode->GetId()) != selectedItems.end())
		{
			controlItem->setSelected(true);
		}
	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例12: addFixtureItem

void SceneEditor::addFixtureItem(Fixture* fixture)
{
    QTreeWidgetItem* item;

    Q_ASSERT(fixture != NULL);

    item = new QTreeWidgetItem(m_tree);
    item->setText(KColumnName, fixture->name());
    item->setText(KColumnID, QString("%1").arg(fixture->id()));

    if (fixture->fixtureDef() == NULL)
    {
        item->setText(KColumnManufacturer, tr("Generic"));
        item->setText(KColumnModel, tr("Generic"));
    }
    else
    {
        item->setText(KColumnManufacturer,
                      fixture->fixtureDef()->manufacturer());
        item->setText(KColumnModel, fixture->fixtureDef()->model());
    }

    /* Select newly-added fixtures so that their channels can be
       quickly disabled/enabled */
    item->setSelected(true);
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例13: addFunction

void FunctionManager::addFunction(Function* function)
{
	QTreeWidgetItem* item;

	Q_ASSERT(function != NULL);
	
	/* Create a new item for the function */
	item = new QTreeWidgetItem(m_tree);
	updateFunctionItem(item, function);

	/* Clear current selection and select only the new one */
	m_tree->clearSelection();
	item->setSelected(true);

	/* Start editing immediately */
	if (slotEdit() == QDialog::Rejected)
	{
		/* Edit dialog was rejected -> delete function */
		deleteSelectedFunctions();
	}
	else
	{
		m_tree->sortItems(KColumnName, Qt::AscendingOrder);
		m_tree->scrollToItem(item);
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:26,代码来源:functionmanager.cpp

示例14: QTreeWidgetItem

void
LTMSidebar::resetSeasons()
{
    if (active == true) return;

    active = true;
    int i;
    for (i=allDateRanges->childCount(); i > 0; i--) {
        delete allDateRanges->takeChild(0);
    }
    QString id = appsettings->cvalue(main->cyclist, GC_LTM_LAST_DATE_RANGE, seasons->seasons.at(0).id().toString()).toString();
    for (i=0; i <seasons->seasons.count(); i++) {
        Season season = seasons->seasons.at(i);
        QTreeWidgetItem *add = new QTreeWidgetItem(allDateRanges, season.getType());
        if (season.id().toString()==id)
            add->setSelected(true);

        // No Drag/Drop for temporary  Season
        if (season.getType() == Season::temporary)
            add->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        else
            add->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
        add->setText(0, season.getName());
    }

    active = false;
}
开发者ID:FuzzyBunnys,项目名称:GoldenCheetah,代码行数:27,代码来源:LTMSidebar.cpp

示例15: slotFindItem

/**
 * Selects a list item whose string begins with the text entered in the edit
 * widget.
 * This slot is connected to the textChanged() signal of the line edit widget.
 * @param	sText	The new text in the edit widget
 */
void SearchList::slotFindItem(const QString& sText)
{
	QList<QTreeWidgetItem*> itemsList;

	// To avoid selecting everything when clearing QLineEdit text
	if (sText.isEmpty())
		return;

	// Find & select all matching items
	itemsList = m_pList->findItems(sText, Qt::MatchStartsWith, m_nSearchCol);

	// If `AutoSortFiles' is true selected items are contiguous. Scroll the central
	// item (if true) or the first (if not) of the selected items to the center of
	// the view
	if (! itemsList.isEmpty()) {
		int i = (Config().getAutoSortFiles()) ? itemsList.count() / 2 : 0;

		m_pList->scrollToItem(itemsList[i], QAbstractItemView::PositionAtCenter);

		QListIterator<QTreeWidgetItem*> it(itemsList);

		m_pList->clearSelection();
		while (it.hasNext()){
			QTreeWidgetItem* pItem = it.next();
			pItem->setSelected(true);
		}
	}
}
开发者ID:bms,项目名称:kscope4,代码行数:34,代码来源:searchlist.cpp


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