本文整理汇总了C++中Q3ListViewItem::childCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ListViewItem::childCount方法的具体用法?C++ Q3ListViewItem::childCount怎么用?C++ Q3ListViewItem::childCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ListViewItem
的用法示例。
在下文中一共展示了Q3ListViewItem::childCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyTree
/* cpView() copies input QListView and add it on the main interface */
void CovariatesView::copyTree(const CovariatesView* aCovView, bool aShowAll)
{
clearSelection();
// Copy the input tree, select 1st selectable covariate and set baseIndex
Q3ListViewItemIterator it(const_cast<CovariatesView*> (aCovView));
while (it.current()) {
// Copy the current item
Q3ListViewItem *newItem;
Q3ListViewItem *inputItem = it.current();
if (inputItem->text(2).isEmpty()) {
if (!inputItem->childCount())
return;
if (inputItem->depth() == 0)
newItem = new Q3ListViewItem(this, lastChild(), inputItem->text(0));
else
newItem = new Q3ListViewItem(findParent(inputItem), lastChild(findParent(inputItem)),
inputItem->text(0));
newItem->setOpen(true);
newItem->setEnabled(false);
return;
}
if (inputItem->depth() == 0)
newItem = new Q3ListViewItem(this, lastChild(), inputItem->text(0),
inputItem->text(1), inputItem->text(2));
else
newItem = new Q3ListViewItem(findParent(inputItem), lastChild(findParent(inputItem)),
inputItem->text(0), inputItem->text(1), inputItem->text(2));
// By default, only enable type I covariates
if (newItem->text(1) != "I")
newItem->setEnabled(false);
++it;
}
Q3ListViewItemIterator all(this, Q3ListViewItemIterator::Selectable);
if (!aShowAll)
showInterestOnly();
}
示例2: state
/*! \reimp */
QAccessible::State QAccessibleListView::state(int child) const
{
State state = Q3AccessibleScrollView::state(child);
Q3ListViewItem *item;
if (!child || !(item = findLVItem(listView(), child)))
return state;
if (item->isSelectable()) {
if (listView()->selectionMode() == Q3ListView::Multi)
state |= MultiSelectable;
else if (listView()->selectionMode() == Q3ListView::Extended)
state |= ExtSelectable;
else if (listView()->selectionMode() == Q3ListView::Single)
state |= Selectable;
if (item->isSelected())
state |= Selected;
}
if (listView()->focusPolicy() != Qt::NoFocus) {
state |= Focusable;
if (item == listView()->currentItem())
state |= Focused;
}
if (item->childCount()) {
if (item->isOpen())
state |= Expanded;
else
state |= Collapsed;
}
if (!listView()->itemRect(item).isValid())
state |= Invisible;
if (item->rtti() == Q3CheckListItem::RTTI) {
if (((Q3CheckListItem*)item)->isOn())
state|=Checked;
}
return state;
}
示例3: it
std::vector<const CCopasiObject * > * CCopasiSimpleSelectionTree::getTreeSelection()
{
std::vector<const CCopasiObject * > * selection = new std::vector<const CCopasiObject * >();
std::map< std::string, const CCopasiObject * > SelectionMap;
if (selectionMode() == Q3ListView::Single && selectedItem())
{
selection->push_back(treeItems[selectedItem()]);
}
else
{
// go through the whole tree and check for selected items.
// if the selected item has children, add all children that are leaves
// and are connected to an object.
// If the item is a leave and is connected to an object, add it directly
Q3ListViewItemIterator it(this);
Q3ListViewItem* currentItem = it.current();
while (currentItem)
{
if (currentItem->isSelected())
{
if (currentItem->childCount() == 0)
{
if (treeItems.find(currentItem) != treeItems.end())
SelectionMap[treeItems[currentItem]->getObjectDisplayName()] = treeItems[currentItem];
}
else
{
Q3ListViewItemIterator it2(currentItem);
Q3ListViewItem* tmpItem = it2.current();
Q3ListViewItem* Ancestor;
while (tmpItem)
{
if ((tmpItem->childCount() == 0) &&
(treeItems.find(tmpItem) != treeItems.end()))
SelectionMap[treeItems[tmpItem]->getObjectDisplayName()] = treeItems[tmpItem];
++it2;
tmpItem = it2.current();
if (!tmpItem) break;
// We continue as long as the current item is an
// ancestor of the tmp item, i.e., it is in the branch
// originating from current item.
for (Ancestor = tmpItem->parent();
Ancestor != currentItem && Ancestor;
Ancestor = Ancestor->parent());
if (!Ancestor) break;
}
}
}
++it;
currentItem = it.current();
}
// Copy the selection set to the selection
selection->resize(SelectionMap.size());
std::vector< const CCopasiObject * >::iterator itSelection = selection->begin();
std::map< std::string, const CCopasiObject * >::const_iterator itSet = SelectionMap.begin();
std::map< std::string, const CCopasiObject * >::const_iterator endSet = SelectionMap.end();
for (; itSet != endSet; ++itSet, ++itSelection)
*itSelection = itSet->second;
}
return selection;
}