📄 qlist.doc
字号:
list.remove(); \endcode The item after the removed item becomes the new current list item if the removed item is not the last item in the list. If the last item is removed, the new last item becomes the current item in Qt 2.x. In 3.0, the current item will be set to null. The current item is set to null if the list becomes empty. All list iterators that refer to the removed item will be set to point to the new current item. \sa remove(), clear(), setAutoDelete(), current()*//*! \fn void QList::removeNode( QLNode *node ) Removes the \e node from the list. This node must exist in the list, otherwise the program may crash. The removed item is deleted if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled. The first item in the list will become the new current list item. The current item is set to null if the list becomes empty. All list iterators that refer to the removed item will be set to point to the item succeeding this item, or the preceding item if the removed item was the last item. \warning Do not call this function unless you are an expert. \sa takeNode(), currentNode() remove() removeRef()*//*! \fn bool QList::removeFirst() Removes the first item from the list. Returns TRUE if successful, or FALSE if the list is empty. The removed item is deleted if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled. The first item in the list becomes the new current list item. The current item is set to null if the list becomes empty. All list iterators that refer to the removed item will be set to point to the new current item. \sa removeLast(), setAutoDelete(), current() remove()*//*! \fn bool QList::removeLast() Removes the last item from the list. Returns TRUE if successful, or FALSE if the list is empty. The removed item is deleted if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled. The last item in the list becomes the new current list item. The current item is set to null if the list becomes empty. All list iterators that refer to the removed item will be set to point to the new current item. \sa removeFirst(), setAutoDelete(), current()*//*! \fn type *QList::take( uint index ) Takes the item at position \e index out of the list without deleting it (even if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled). Returns a pointer to the item taken out of the list, or null if the index is out of range. The valid range is <code>0 .. (count() - 1)</code> inclusive. The item after the taken item becomes the new current list item if the taken item is not the last item in the list. If the last item is taken, the new last item becomes the current item in Qt 2.x. In 3.0, the current item will be set to null. The current item is set to null if the list becomes empty. All list iterators that refer to the taken item will be set to point to the new current item. \sa remove(), clear(), current()*//*! \fn type *QList::take() Takes the current item out of the list without deleting it (even if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled). Returns a pointer to the item taken out of the list, or null if the current item is null. The item after the taken item becomes the new current list item if the taken item is not the last item in the list. If the last item is taken, the new last item becomes the current item in Qt 2.x. In 3.0, the current item will be set to null. The current item is set to null if the list becomes empty. All list iterators that refer to the taken item will be set to point to the new current item. \sa remove(), clear(), current()*//*! \fn type *QList::takeNode( QLNode *node ) Takes the \e node out of the list without deleting its item (even if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled). Returns a pointer to the item taken out of the list. This node must exist in the list, otherwise the program may crash. The first item in the list becomes the new current list item. All list iterators that refer to the taken item will be set to point to the item succeeding this item, or the preceding item if the taken item was the last item. \warning Do not call this function unless you are an expert. \sa removeNode(), currentNode()*//*! \fn void QList::clear() Removes all items from the list. The removed items are deleted if \link QCollection::setAutoDelete() auto-deletion\endlink is enabled. All list iterators that access this list will be reset. \sa remove(), take(), setAutoDelete()*//*! \fn int QList::find( const type *item ) Finds the first occurrence of \e item in the list. If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to null, the current index to -1 and returns -1. The compareItems() function is called when searching for the item in the list. If compareItems() is not reimplemented, it is more efficient to call findRef(). \sa findNext(), findRef(), compareItems(), current()*//*! \fn int QList::findNext( const type *item ) Finds the next occurrence of \e item in the list, starting from the current list item. If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to null, the current index to -1 and returns -1. The compareItems() function is called when searching for the item in the list. If compareItems() is not reimplemented, it is more efficient to call findNextRef(). \sa find(), findNextRef(), compareItems(), current()*//*! \fn int QList::findRef( const type *item ) Finds the first occurrence of \e item in the list. If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to null, the current index to -1 and returns -1. Calling this function is must faster than find(), because find() compares \e item with each list item using compareItems(). This function only compares the pointers. \sa findNextRef(), find(), current()*//*! \fn int QList::findNextRef( const type *item ) Finds the next occurrence of \e item in the list, starting from the current list item. If the item is found, the list sets the current item to point to the found item and returns the index of this item. If the item is not found, the list sets the current item to null, the current index to -1 and returns -1. Calling this function is must faster than findNext(), because findNext() compares \e item with each list item using compareItems(). This function only compares the pointers. \sa findRef(), findNext(), current()*//*! \fn uint QList::contains( const type *item ) const Counts and returns the number of occurrences of \e item in the list. The compareItems() function is called when looking for the \e item in the list. If compareItems() is not reimplemented, it is more efficient to call containsRef(). Does not affect the current list item. \sa containsRef(), compareItems()*//*! \fn uint QList::containsRef( const type *item ) const Counts and returns the number of occurrences of \e item in the list. Calling this function is must faster than contains(), because contains() compares \e item with each list item using compareItems(). This function only compares the pointers. Does not affect the current list item. \sa contains()*//*! \fn type *QList::at( uint index ) Returns a pointer to the item at position \e index in the list, or null if the index is out of range. Sets the current list item to this item if \e index is valid. The valid range is <code>0 .. (count() - 1)</code> inclusive. This function is very efficient. It starts scanning from the first item, last item or current item, whichever is closest to \e index. \sa current()*//*! \fn int QList::at() const Returns the index of the current list item. The returned value is -1 if the current item is null. \sa current()*//*! \fn type *QList::current() const Returns a pointer to the current list item. The current item may be null (implies that the current index is -1). \sa at()*//*! \fn QLNode *QList::currentNode() const Returns a pointer to the current list node. The node can be kept and removed later using removeNode(). The advantage is that the item can be removed directly without searching the list. \warning Do not call this function unless you are an expert. \sa removeNode(), takeNode(), current()*//*! \fn type *QList::getFirst() const Returns a pointer to the first item in the list, or null if the list is empty. Does not affect the current list item. \sa first(), getLast()*//*! \fn type *QList::getLast() const Returns a pointer to the last item in the list, or null if the list is empty. Does not affect the current list item. \sa last(), getFirst()*//*! \fn type *QList::first() Returns a pointer to the first item in the list and makes this the current list item, or null if the list is empty. \sa getFirst(), last(), next(), prev(), current()*//*! \fn type *QList::last() Returns a pointer to the last item in the list and makes this the current list item, or null if the list is empty. \sa getLast(), first(), next(), prev(), current()*//*! \fn type *QList::next() Returns a pointer to the item succeeding the current item. Returns null if the current item is null or equal to the last item. Makes the succeeding item current. If the current item before this function call was the last item, the current item will be set to null. If the current item was null, this function does nothing. \sa first(), last(), prev(), current()*//*! \fn type *QList::prev() Returns a pointer to the item preceding the current item. Returns null if the current item is null or equal to the first item. Makes the preceding item current. If the current item before this function call was the first item, the current item will be set to null. If the current item was null, this function does nothing. \sa first(), last(), next(), current()*//*! \fn void QList::toVector( QGVector *vec ) const Stores all list items in the vector \e vec. The vector must be have the same item type, otherwise the result will be undefined.*//***************************************************************************** QListIterator documentation *****************************************************************************//*! \class QListIterator qlist.h \brief The QListIterator class provides an iterator for QList collections.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -