return myChildren.indexOf( (SUIT_DataObject*)obj );
}
+/*!
+ \brief Moves the child position from current to new one.
+ \param theObj child object
+ \param theNewPos child objectnew position in the children list
+
+*/
+void SUIT_DataObject::moveChildPos( SUIT_DataObject* theObj, int theNewPos)
+{
+ if (myChildren.size() <= 1) return;
+
+ int aNewPos = theNewPos;
+ if (aNewPos < 0) aNewPos = 0;
+ if (aNewPos > (myChildren.size() - 1)) aNewPos = myChildren.size() - 1;
+
+ if (myChildren.removeOne(theObj))
+ myChildren.insert(aNewPos, theObj);
+}
+
+
/*!
\brief Get child object by the specified index.
\param idx child object index
return myParent ? myParent->childPos( this ) : 0;
}
+/*!
+ \brief Sets new position of the object in parent's list
+*/
+void SUIT_DataObject::setPosition(int theNewPos)
+{
+ if (theNewPos == position()) return;
+ if (!myParent) return;
+ myParent->moveChildPos(this, theNewPos);
+}
+
/*!
\brief Get the next sibling data object in the children list.
\return child object or 0 if there is no next sibling
int childCount() const;
int childPos( const SUIT_DataObject* ) const;
+ void moveChildPos( SUIT_DataObject*, int );
SUIT_DataObject* childObject( const int ) const;
int level() const;
int position() const;
+ void setPosition(int);
SUIT_DataObject* nextBrother() const;
SUIT_DataObject* prevBrother() const;