本文整理汇总了C++中childCount函数的典型用法代码示例。如果您正苦于以下问题:C++ childCount函数的具体用法?C++ childCount怎么用?C++ childCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了childCount函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: childCount
BasketListViewItem* BasketListViewItem::lastChild()
{
int count = childCount();
if (count <= 0)
return 0;
return (BasketListViewItem*)(child(count - 1));
}
开发者ID:bewitchingme,项目名称:basket,代码行数:7,代码来源:basketlistview.cpp
示例2: isContain
bool ObjectItem::isContain(ObjectItem **ppRet, QPoint &pos, int frame, bool bChild, bool bCheckFlag)
{
if (bChild)
{
for (int i = childCount() - 1; i >= 0; i--)
{
if (child(i)->isContain(ppRet, pos, frame, true))
{
return true;
}
}
}
if (bCheckFlag)
{
int flag = data(Qt::CheckStateRole).toInt();
if (!(flag & kState_Disp) || (flag & kState_Lock))
{ // 非表示
return false;
}
}
bool valid;
FrameData d = getDisplayFrameData(frame, &valid);
if (valid && isContain(d, pos, getDisplayMatrix(frame)))
{
*ppRet = this;
return true;
}
return false;
}
开发者ID:chocoball,项目名称:AnimationCreator,代码行数:31,代码来源:objectitem.cpp
示例3: return
int EventBrowser::FindEvent(QTreeWidgetItem *parent, QString filter, uint32_t after, bool forward)
{
if(parent == NULL) return -1;
for(int i = forward ? 0 : parent->childCount() - 1;
i >= 0 && i < parent->childCount();
i += forward ? 1 : -1)
{
auto n = parent->child(i);
uint eid = n->data(COL_EID, Qt::UserRole).toUInt();
bool matchesAfter = (forward && eid > after) || (!forward && eid < after);
if(matchesAfter)
{
QString name = n->text(COL_NAME);
if(name.contains(filter, Qt::CaseInsensitive))
return (int)eid;
}
if(n->childCount() > 0)
{
int found = FindEvent(n, filter, after, forward);
if(found > 0)
return found;
}
}
return -1;
}
开发者ID:281627166,项目名称:renderdoc,代码行数:32,代码来源:EventBrowser.cpp
示例4: mergeWith
bool SCgCommandSelectedObjectMove::mergeWith (const QUndoCommand* command)
{
if (command->id() != id() || childCount() || command->childCount())
return false;
const SCgCommandSelectedObjectMove* c = static_cast<const SCgCommandSelectedObjectMove*>(command);
if(mUndoInfo.keys() != c->mUndoInfo.keys())
return false;
qreal maxManhattanLength = 0;
SCgScene::ObjectUndoInfo::ConstIterator const_it = c->mUndoInfo.begin();
while(const_it != c->mUndoInfo.end())
{
QPointF offset = const_it.value().second.second - const_it.value().first.second;
if(offset.manhattanLength() > maxManhattanLength)
maxManhattanLength = offset.manhattanLength();
++const_it;
}
if(maxManhattanLength > 35)
return false;
SCgScene::ObjectUndoInfo::iterator it = mUndoInfo.begin();
while(it != mUndoInfo.end())
{
it.value().second = c->mUndoInfo.value(it.key()).second;
++it;
}
return true;
}
开发者ID:AlexKlybik,项目名称:kbe,代码行数:31,代码来源:scgcommandselectedobjectmove.cpp
示例5:
KcmTreeItem *KcmTreeItem::child(const int row)
{
if(childCount() > row) {
return m_children.value(row);
}
return NULL;
}
开发者ID:KDE,项目名称:kde-workspace,代码行数:7,代码来源:kcmtreeitem.cpp
示例6: widget
/*! \reimp */
int QAccessibleWidget::childAt(int x, int y) const
{
QWidget *w = widget();
if (!w->isVisible())
return -1;
QPoint gp = w->mapToGlobal(QPoint(0, 0));
if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
return -1;
QWidgetList list = childWidgets(w);
int ccount = childCount();
// a complex child
if (list.size() < ccount) {
for (int i = 1; i <= ccount; ++i) {
if (rect(i).contains(x, y))
return i;
}
return 0;
}
QPoint rp = w->mapFromGlobal(QPoint(x, y));
for (int i = 0; i<list.size(); ++i) {
QWidget *child = list.at(i);
if (!child->isWindow() && !child->isHidden() && child->geometry().contains(rp)) {
return i + 1;
}
}
return 0;
}
开发者ID:Arise,项目名称:Open-DPI-Detector,代码行数:31,代码来源:qaccessiblewidget.cpp
示例7: changeSymbologySettings
void QgsLegendLayer::changeSymbologySettings( const QgsMapLayer* theMapLayer,
const SymbologyList& newSymbologyItems )
{
if ( !theMapLayer )
{
return;
}
QgsLegendSymbologyItem* theSymbologyItem = 0;
//remove the symbology items under the legend layer
for ( int i = childCount(); i >= 0; --i )
{
theSymbologyItem = dynamic_cast<QgsLegendSymbologyItem *>( child( i ) );
if ( theSymbologyItem )
{
delete takeChild( i );
}
}
//add the new symbology items
int childposition = 0; //position to insert the items
for ( SymbologyList::const_iterator it = newSymbologyItems.begin(); it != newSymbologyItems.end(); ++it )
{
QgsLegendSymbologyItem* theItem = new QgsLegendSymbologyItem( it->second.width(), it->second.height() );
theItem->setText( 0, it->first );
theItem->setIcon( 0, QIcon( it->second ) );
insertChild( childposition, theItem );
++childposition;
}
}
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:33,代码来源:qgslegendlayer.cpp
示例8: switch
/*! \reimp */
int QAccessibleApplication::navigate(RelationFlag relation, int entry,
QAccessibleInterface **target) const
{
if (!target)
return -1;
*target = 0;
QObject *targetObject = 0;
switch (relation) {
case Self:
targetObject = object();
break;
case Child:
if (entry > 0 && entry <= childCount()) {
const QWidgetList tlw(topLevelWidgets());
if (tlw.count() >= entry)
targetObject = tlw.at(entry-1);
} else {
return -1;
}
break;
case FocusChild:
targetObject = QApplication::activeWindow();
break;
default:
break;
}
*target = QAccessible::queryAccessibleInterface(targetObject);
return *target ? 0 : -1;
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:32,代码来源:qaccessibleobject.cpp
示例9: validate
bool ObjectItem::validate(bool bRecv)
{
int i;
QList<unsigned short> frames;
for (i = 0; i < m_frameDatas.size(); i++)
{
const FrameData &d = m_frameDatas.at(i);
if (frames.contains(d.frame))
{
return false;
}
frames.append(d.frame);
}
if (bRecv)
{
for (i = 0; i < childCount(); i++)
{
if (!child(i)->validate(bRecv))
{
return false;
}
}
}
return true;
}
开发者ID:chocoball,项目名称:AnimationCreator,代码行数:27,代码来源:objectitem.cpp
示例10: CharString
CharString NounShip::status() const
{
CharString sTargetInfo;
// team & ship type..
sTargetInfo += CharString().format("%s - %s\n", teamName(), nounContext()->name() );
// hull %
sTargetInfo += CharString().format("Hull: %d%%\n", int( damageRatioInv() * 100) );
int armor = 0, maxArmor = 0;
int shield = 0, maxShield = 0;
for(int i=0;i<childCount();i++)
{
BaseNode * pChild = child(i);
if ( WidgetCast<GadgetShield>( pChild ) )
{
shield += ((GadgetShield *)pChild)->charge();
maxShield += ((GadgetShield *)pChild)->maxCharge();
}
else if ( WidgetCast<GadgetArmor>( pChild ) )
{
armor += ((GadgetArmor *)pChild)->armor();
maxArmor += ((GadgetArmor *)pChild)->maxArmor();
}
}
if ( maxShield > 0 )
sTargetInfo += CharString().format("Shield: %d%%\n", (shield * 100) / maxShield);
if ( maxArmor > 0 )
sTargetInfo += CharString().format("Armor: %d%%\n", (armor * 100) / maxArmor );
return sTargetInfo;
}
开发者ID:BlackYoup,项目名称:darkspace,代码行数:33,代码来源:NounShip.cpp
示例11: dlg
void KACLListView::slotAddEntry()
{
int allowedTypes = NamedUser | NamedGroup;
if ( !m_hasMask )
allowedTypes |= Mask;
int allowedDefaultTypes = NamedUser | NamedGroup;
if ( !findDefaultItemByType( Mask ) )
allowedDefaultTypes |= Mask;
if ( !hasDefaultEntries() )
allowedDefaultTypes |= User | Group;
EditACLEntryDialog dlg( this, 0,
allowedUsers( false ), allowedGroups( false ),
allowedUsers( true ), allowedGroups( true ),
allowedTypes, allowedDefaultTypes, m_allowDefaults );
dlg.exec();
KACLListViewItem *item = dlg.item();
if ( !item ) return; // canceled
if ( item->type == Mask && !item->isDefault ) {
m_hasMask = true;
m_mask = item->value;
}
if ( item->isDefault && !hasDefaultEntries() ) {
// first default entry, fill in what is needed
if ( item->type != User ) {
unsigned short v = findDefaultItemByType( User )->value;
new KACLListViewItem( this, User, v, true );
}
if ( item->type != Group ) {
unsigned short v = findDefaultItemByType( Group )->value;
new KACLListViewItem( this, Group, v, true );
}
if ( item->type != Others ) {
unsigned short v = findDefaultItemByType( Others )->value;
new KACLListViewItem( this, Others, v, true );
}
}
const KACLListViewItem *defaultMaskItem = findDefaultItemByType( Mask );
if ( item->isDefault && !defaultMaskItem ) {
unsigned short v = calculateMaskValue( true );
new KACLListViewItem( this, Mask, v, true );
}
if ( !item->isDefault && !m_hasMask &&
( item->type == Group
|| item->type == NamedUser
|| item->type == NamedGroup ) ) {
// auto-add a mask entry
unsigned short v = calculateMaskValue( false );
new KACLListViewItem( this, Mask, v, false );
m_hasMask = true;
m_mask = v;
}
calculateEffectiveRights();
sort();
setCurrentItem( item );
// TQListView doesn't seem to emit, in this case, and we need to update
// the buttons...
if ( childCount() == 1 )
emit currentChanged( item );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:59,代码来源:kacleditwidget.cpp
示例12: setOpen
void classSpecialColumns::setOpen( bool o )
{
if ( o && !childCount() )
{
LoadColumns();
}
QListViewItem::setOpen( o );
}
开发者ID:greenplum-db,项目名称:gpclients,代码行数:8,代码来源:classSpecialColumns.cpp
示例13:
const Object *Container::childAt(NPT_Ordinal index) const
{
Object *child = NULL;
if (index < childCount()) {
child = *m_children.GetItem(index);
}
return child;
}
开发者ID:chenkaigithub,项目名称:GenieWin8,代码行数:8,代码来源:avcore4.cpp
示例14: setOpen
void classPrimaryKeys::setOpen( bool o )
{
if ( o && !childCount() )
{
LoadColumns();
}
QListViewItem::setOpen( o );
}
开发者ID:greenplum-db,项目名称:gpclients,代码行数:8,代码来源:classPrimaryKeys.cpp
示例15: childCount
void SpawnListItem::updateTitle(const QString& name)
{
// update childcount in header
QString temp;
temp.sprintf("%s (%d)",
(const char*)name, childCount());
setText(tSpawnColName, temp);
} // end if spawn should be in this category
开发者ID:xbackupx,项目名称:showeqx,代码行数:8,代码来源:spawnlistcommon.cpp
示例16: childAt
TwXmlElement* TwXmlElement::childAt(int index)
{
if (index < 0 || index >= childCount())
{
return NULL;
}
return m_dptr->children.at(index);
}
开发者ID:hiitiger,项目名称:tworkvx,代码行数:8,代码来源:twxmldocument.cpp
示例17: childCount
int QAccessibleInterfaceEx_QtDShell::__override_childCount(bool static_call) const
{
if (static_call) {
return 0;
} else {
return childCount();
}
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:8,代码来源:QAccessibleInterfaceEx_shell.cpp
示例18: childCount
int QAccessibleWidgetEx_QtDShell::__override_childCount(bool static_call) const
{
if (static_call) {
return QAccessibleWidgetEx::childCount();
} else {
return childCount();
}
}
开发者ID:dreamsxin,项目名称:nawia,代码行数:8,代码来源:QAccessibleWidgetEx_shell.cpp
示例19: setOpen
void classDriver::setOpen( bool o )
{
if ( o && !childCount() )
{
setExpandable( FALSE );
}
QListViewItem::setOpen( o );
}
开发者ID:greenplum-db,项目名称:gpclients,代码行数:8,代码来源:classDriver.cpp
示例20: network
NoiseNetwork* Displace::network() {
// 0. query module for readieness
// a module is ready if all dependencies are sadisfied, if that did not happen
// we can't use it as libnoise could throw an exception or do other weird things...
if (ready()) {
// 1. create a noiseNetwork (if generator module)
NoiseNetwork* noiseNetwork = new NoiseNetwork;
// 2. construct the local module (in this case Perlin)
noise::module::Displace* m_Displace = new noise::module::Displace();
noiseNetwork->addModule(m_Displace);
// 3. assign all properties
// m_Displace->SetOctaveCount (property("OctaveCount"));
//FIXME: implement this
// 4. connect all source modules (in case of a generator module: none) & merge the NoiseNetwork(s)
// foreach(input i)
// m_perlin->SetSourceModule(i->portnumber, i->topLevelModule);
// noiseNetwork->merge(i->network)
// foreach(input m)
// m_perlin->SetControlModule(m->topLevelModule);
// noiseNetwork->merge(m->network)
for (int x=0; x < childCount(); ++x) {
DataAbstractItem* chi = childItems()[x];
if (chi->getObjectType() == DataItemType::PORT) {
DataPort* p = static_cast<DataPort*>(chi);
if (p->PortDirection() == PortDirection::IN || p->PortDirection() == PortDirection::MOD) {
// 1. reconstruct the Connection
DataConnection* c = static_cast<DataConnection*> (p->referenceChildItems().first());
// 2. reconstruct the remote port
DataAbstractItem* abstractPort = c->dst();
// 3. reconstruct the remote module
DataAbstractModule* module = static_cast<DataAbstractModule*> (abstractPort->parent());
// 4. check if it is ready
/*
if (p->PortDirection() == PortDirection::IN) {
NoiseNetwork* n = module->network();
m_Displace->SetSourceModule(p->PortNumber(), n->topLevelModule());
noiseNetwork += n;
}
*/
/*
if (p->PortDirection() == PortDirection::MOD) {
NoiseNetwork* n = module->network();
m_Displace->SetControlModule(n->topLevelModule());
noiseNetwork += n;
}
*/
}
}
}
return noiseNetwork;
}
return NULL;
}
开发者ID:qknight,项目名称:springrts.com-random-map-generator,代码行数:58,代码来源:Displace.cpp
注:本文中的childCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论