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


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

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


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

示例1: updateArchives

void ArchiveList::updateArchives(QList<Archive *> archivesOrig)
{
    QSet<QString> expandedLanguages;
    QSet<QString> knownLanguages;
    QSet<ArchiveID> expandedItems;

    for (int i = 0; i < topLevelItemCount(); i ++) {
        QTreeWidgetItem *langItem = topLevelItem(i);
        const QString &lang = langItem->text(0);
        if (langItem->isExpanded())
            expandedLanguages += lang;
        knownLanguages += lang;
        for (int j = 0; j < langItem->childCount(); j ++) {
            QTreeWidgetItem *dateItem = langItem->child(j);
            if (dateItem->isExpanded())
                expandedItems += ArchiveID(lang, dateItem->text(0));
        }
    }

    clear();

    QList<Archive *> archives(archivesOrig);
    qSort(archives.begin(), archives.end(), Archive::comparePointers);

    QTreeWidgetItem *topItem(0);
    QString lastLanguage;

    foreach (Archive *a, archives) {
        if (lastLanguage != a->getLanguage() || a->getLanguage().isEmpty()) {
            lastLanguage = a->getLanguage();
            topItem = new QTreeWidgetItem(this, QStringList() << lastLanguage);
            addTopLevelItem(topItem);
            if (expandedLanguages.contains(lastLanguage))
                topItem->setExpanded(true);
        }
        QTreeWidgetItem *item = new QTreeWidgetItem(topItem);
        item->setText(0, a->getDate());

        if (expandedItems.contains(a->getID()))
            item->setExpanded(true);

        if (qobject_cast<DownloadableArchive *>(a)) {
            fillDownloadableArchiveItem(static_cast<DownloadableArchive *>(a), item);
        } else if (qobject_cast<PartialArchive *>(a)) {
            if (!knownLanguages.contains(a->getLanguage()))
                topItem->setExpanded(true);
            fillPartialArchiveItem(static_cast<PartialArchive *>(a), item);
        } else if (qobject_cast<LocalArchive *>(a)) {
            if (!knownLanguages.contains(a->getLanguage()))
                topItem->setExpanded(true);
            fillLocalArchiveItem(static_cast<LocalArchive *>(a), item);
        }
    }
    resizeColumnToContents(0);
    resizeColumnToContents(1);
    resizeColumnToContents(2);
    resizeColumnToContents(3);
}
开发者ID:Iktwo,项目名称:evopedia,代码行数:58,代码来源:archivelist.cpp

示例2: moveSelection

void Parametertuner::moveSelection(int dir)
{
	QTreeWidgetItem* thisItem = getSelectedItem();
	if (!thisItem)
	{
		m_ui.parameter_root_widget->topLevelItem(0)->setSelected(true);
		return;
	}
	QTreeWidgetItem* parent = thisItem->parent();
	QTreeWidgetItem* nextItem;

	if (!parent)
	{
		parent = m_ui.parameter_root_widget->invisibleRootItem();
	}
	int thisItemIndex = parent->indexOfChild(thisItem);
	if (thisItem->isExpanded() && dir == DOWN)
	{
		nextItem = thisItem->child(0);
		updateSelection(thisItem, nextItem);
		return;
	}
	else if (!parent->child(thisItemIndex + dir))
	{
		updateSelection(thisItem, parent);
		return;
	}
	else
	{
		nextItem = parent->child(thisItemIndex + dir);
		updateSelection(thisItem, nextItem);
		return;
	}

}
开发者ID:NimbRo-Copter,项目名称:nimbro-op-ros,代码行数:35,代码来源:parametertuner.cpp

示例3: slotBtOK

//-------------------------------------------------------------------------------
void DialogSelectMetar::slotBtOK()
{
	QTreeWidgetItemIterator iter (treeWidget);
	QTreeWidgetItem *it;
	QString val;
	QStringList expandedlist, icaolist;
	// Write expanded items in settings
    while (*iter) {
		it = *iter;
		if (it->data(0, Qt::UserRole) == "country"
			|| it->data(0, Qt::UserRole) == "state") 
		{
			if (it->isExpanded()) {
				val = (it->data(0, Qt::UserRole+1)).toString();
				expandedlist << val;
			}
		}
		iter ++;
	}
	iter = QTreeWidgetItemIterator (treeWidget, QTreeWidgetItemIterator::Checked);
    while (*iter) {
		it = *iter;
		if (it->data(0, Qt::UserRole) == "icao") 
		{
			val = (it->data(0, Qt::UserRole+1)).toString();
			icaolist << val;
		}
		iter ++;
	}
	Util::setSetting ("metar_country_expanded", expandedlist);
	Util::setSetting ("metar_selected", icaolist);
	emit metarListChanged ();
	Util::setSetting ("metar_tree_offset", treeWidget->verticalScrollBar()->sliderPosition());
    accept();
}
开发者ID:Don42,项目名称:zyGrib,代码行数:36,代码来源:DialogSelectMetar.cpp

示例4: isExpanded

bool QTreeWidgetItemProto::isExpanded()	        const
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    return item->isExpanded();
  return false;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: isGroupExpanded

bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
{
	QTreeWidgetItem * item = getItem (groupIndex);
	if ( !item ) 
	{
		return false;
	}

  return item->isExpanded();
}
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:10,代码来源:qgsapplegendinterface.cpp

示例6: isShown

bool BasketListViewItem::isShown()
{
    QTreeWidgetItem *item = parent();
    while (item) {
        if (!item->isExpanded())
            return false;
        item = item->parent();
    }
    return true;
}
开发者ID:bewitchingme,项目名称:basket,代码行数:10,代码来源:basketlistview.cpp

示例7:

/*
  Store in 'set' the tag IDs of the items that are in expanded state
  and are descendants of 'parent'
*/
void
query_listview::store_expanded_state(QTreeWidgetItem* parent,
				     QSet<uint>* set)
{
  for (int i=0; i<parent->childCount(); ++i) {
    QTreeWidgetItem* item = parent->child(i);
    if (item->isExpanded()) {
      query_tag_lvitem* t = static_cast<query_tag_lvitem*>(item);
      set->insert(t->m_tag_id);
    }
    if (item->childCount()>0)
      store_expanded_state(item, set);
  }
}
开发者ID:AleksKots,项目名称:Manitou,代码行数:18,代码来源:query_listview.cpp

示例8: ChangeValue

void Parametertuner::ChangeValue(int dir)
{
	QTreeWidgetItem* thisItem;
	if (!(thisItem = getSelectedItem()))
		return;

	if (thisItem->childCount() != 0)
	{
		if (dir == RIGHT && (!thisItem->isExpanded()))
			thisItem->setExpanded(true);
		else if (dir == LEFT && thisItem->isExpanded())
			thisItem->setExpanded(false);
		return;
	}
	ParameterWidgetBase* param;
	param = (ParameterWidgetBase *)m_ui.parameter_root_widget->itemWidget(thisItem, 1);
	if (!param)
		return;

	if (dir == LEFT)
		param->DecValue();
	else
		param->IncValue();
}
开发者ID:NimbRo-Copter,项目名称:nimbro-op-ros,代码行数:24,代码来源:parametertuner.cpp

示例9:

dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_item_is_expanded (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args.This ());
      if (item) { result = v8::Boolean::New (item->isExpanded ()); }
   }

   return scope.Close (result);
}
开发者ID:bstewart33,项目名称:js,代码行数:15,代码来源:dmzJsModuleUiV8QtBasicTreeWidget.cpp

示例10: HandleDragMoveControlMimeData

void HierarchyTreeControl::HandleDragMoveControlMimeData(QDragMoveEvent *event, const ControlMimeData* /*mimeData*/)
{
    DropIndicatorPosition position = dropIndicatorPosition();
    Logger::Warning("POSITION TYPE^ %i", position);

	// Where we are in tree?
	QTreeWidgetItem* item = itemAt(event->pos());
	if (!item)
	{
		HierarchyTreeController::Instance()->ResetSelectedControl();
		return;
	}

	HierarchyTreeNode::HIERARCHYTREENODEID insertInto = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
	QVariant data = item->data(ITEM_ID);
	insertInto = data.toInt();
	
	// Handle specific types of nodes.
	HierarchyTreeNode* nodeToInsertControlTo = HierarchyTreeController::Instance()->GetTree().GetNode(insertInto);
	if (dynamic_cast<HierarchyTreePlatformNode*>(nodeToInsertControlTo) ||
		dynamic_cast<HierarchyTreeAggregatorControlNode*>(nodeToInsertControlTo))
	{
		// Don't allow to drop the controls directly to Platform or Aggregator.
		HierarchyTreeController::Instance()->ResetSelectedControl();
		return;
	}
	
	// Expand the items while dragging control on them.
	if (!item->isExpanded())
	{
		item->setExpanded(true);
	}

	scrollTo(indexAt(event->pos()));

	HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(nodeToInsertControlTo);
	if (controlNode)
	{
		// Don't reselect the same control, if it is already selected.
		if (!HierarchyTreeController::Instance()->IsControlSelected(controlNode))
		{
			HierarchyTreeController::Instance()->ResetSelectedControl();
			HierarchyTreeController::Instance()->SelectControl(controlNode);
		}
	}

	event->accept();
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:48,代码来源:hierarchytreecontrol.cpp

示例11: topLevelItemCount

QList<QTreeWidgetItem *> FeedListWidget::getAllOpenedFolders(QTreeWidgetItem *parent) const
{
    QList<QTreeWidgetItem *> openedFolders;
    int nbChildren = (parent ? parent->childCount() : topLevelItemCount());
    for (int i = 0; i < nbChildren; ++i) {
        QTreeWidgetItem *item (parent ? parent->child(i) : topLevelItem(i));
        if (isFolder(item) && item->isExpanded()) {
            QList<QTreeWidgetItem *> openedSubfolders = getAllOpenedFolders(item);
            if (!openedSubfolders.empty())
                openedFolders << openedSubfolders;
            else
                openedFolders << item;
        }
    }
    return openedFolders;
}
开发者ID:paolo-sz,项目名称:qBittorrent,代码行数:16,代码来源:feedlistwidget.cpp

示例12: itemAt

void
rightclick_tree_widget::mousePressEvent(QMouseEvent *event) {
  if (event->button() != Qt::RightButton) {
    QTreeWidget::mousePressEvent(event);
    return;
  }

  QTreeWidgetItem *item = itemAt(event->pos());
  if (item) {
#if QT_VERSION >= 0x040200
    gui->expand_all_elements(item, !item->isExpanded());
#else   // QT_VERSION >= 0x040200
    gui->expand_all_elements(item, !item->treeWidget()->isItemExpanded(item));
#endif  // QT_VERSION >= 0x040200
  }
}
开发者ID:CharlesLio,项目名称:mkvtoolnix,代码行数:16,代码来源:qt_ui.cpp

示例13: itemUp

// move an item one position up
void UserMenuTree::itemUp()
{
	QTreeWidgetItem *current = currentItem();
	UserMenuItem *aboveitem = dynamic_cast<UserMenuItem *>(itemAbove(current));
	if (!aboveitem) {
		return;
	}

	bool expanded = current->isExpanded();
	blockSignals(true);

	QTreeWidgetItem *aboveparent = aboveitem->parent();
	int aboveindex = itemIndex(aboveparent,aboveitem);

	UserMenuItem *parent = dynamic_cast<UserMenuItem *>(current->parent());
	int index = itemIndex(parent,current);
	takeItem(parent,current);

	if ( parent!=aboveparent && index!=0 ) {
		aboveindex++;
	}

	if ( parent==aboveparent &&  aboveitem->menutype()==UserMenuData::Submenu ) {
		insertItem(aboveitem,0,current);
	}
	else {
		insertItem(aboveparent,aboveindex,current);
	}

	// update model data of old and new parent, if it has changed
	UserMenuItem *newparent = dynamic_cast<UserMenuItem *>(current->parent());
	if ( parent != newparent ) {
		if ( parent ) {
			parent->setModelData();
			parent->setText(0, parent->updateMenutitle());
		}
		if ( newparent ) {
			newparent->setModelData();
			newparent->setText(0, newparent->updateMenutitle());
		}
	}

	current->setExpanded(expanded);
	setCurrentItem(current);
	blockSignals(false);
}
开发者ID:fagu,项目名称:kileip,代码行数:47,代码来源:usermenutree.cpp

示例14: itemDown

// move an item one position down
void UserMenuTree::itemDown()
{
	QTreeWidgetItem *current = currentItem();
	bool expanded = current->isExpanded();
	blockSignals(true);

	// get all necessary parameter
	UserMenuItem *parent = dynamic_cast<UserMenuItem *>(current->parent());
	int index = itemIndex(parent,current);
	int children = numChildren(parent);

	// successor exists?
	if ( index < children-1 ) {
		UserMenuItem *successor = dynamic_cast<UserMenuItem *>( itemAtIndex(parent,index+1) );
		takeItem(parent,current);
		if ( successor->menutype() == UserMenuData::Submenu ) {
			successor->insertChild(0,current);
		}
		else {
			insertItem(parent,index+1,current);
		}
	}
	else if ( parent ) {
			QTreeWidgetItem *grandparent = parent->parent();
			int parentindex = itemIndex(grandparent,parent);
			takeItem(parent,current);
			insertItem(grandparent,parentindex+1,current);
	}

	// update model data of old and new parent, if it has changed
	UserMenuItem *newparent = dynamic_cast<UserMenuItem *>(current->parent());
	if ( parent != newparent ) {
		if ( parent ) {
			parent->setModelData();
			parent->setText(0, parent->updateMenutitle());
		}
		if ( newparent ) {
			newparent->setModelData();
			newparent->setText(0, newparent->updateMenutitle());
		}
	}

	current->setExpanded(expanded);
	setCurrentItem(current);
	blockSignals(false);
}
开发者ID:fagu,项目名称:kileip,代码行数:47,代码来源:usermenutree.cpp

示例15: populatePlanningSceneTreeView

void MotionPlanningFrame::populatePlanningSceneTreeView()
{
  moveit_warehouse::PlanningSceneStoragePtr planning_scene_storage = planning_scene_storage_;
  if (!planning_scene_storage)
    return;

  ui_->planning_scene_tree->setUpdatesEnabled(false);

  // remember which items were expanded
  std::set<std::string> expanded;
  for (int i = 0; i < ui_->planning_scene_tree->topLevelItemCount(); ++i)
  {
    QTreeWidgetItem* it = ui_->planning_scene_tree->topLevelItem(i);
    if (it->isExpanded())
      expanded.insert(it->text(0).toStdString());
  }

  ui_->planning_scene_tree->clear();
  std::vector<std::string> names;
  planning_scene_storage->getPlanningSceneNames(names);

  for (const std::string& name : names)
  {
    std::vector<std::string> query_names;
    planning_scene_storage->getPlanningQueriesNames(query_names, name);
    QTreeWidgetItem* item =
        new QTreeWidgetItem(ui_->planning_scene_tree, QStringList(QString::fromStdString(name)), ITEM_TYPE_SCENE);
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    item->setToolTip(0, item->text(0));  // we use the tool tip as a backup of the old name when renaming
    for (const std::string& query_name : query_names)
    {
      QTreeWidgetItem* subitem =
          new QTreeWidgetItem(item, QStringList(QString::fromStdString(query_name)), ITEM_TYPE_QUERY);
      subitem->setFlags(subitem->flags() | Qt::ItemIsEditable);
      subitem->setToolTip(0, subitem->text(0));
      item->addChild(subitem);
    }

    ui_->planning_scene_tree->insertTopLevelItem(ui_->planning_scene_tree->topLevelItemCount(), item);
    if (expanded.find(name) != expanded.end())
      ui_->planning_scene_tree->expandItem(item);
  }
  ui_->planning_scene_tree->sortItems(0, Qt::AscendingOrder);
  ui_->planning_scene_tree->setUpdatesEnabled(true);
  checkPlanningSceneTreeEnabledButtons();
}
开发者ID:ros-planning,项目名称:moveit,代码行数:46,代码来源:motion_planning_frame_scenes.cpp


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