Logo Search packages:      
Sourcecode: qt4-x11 version File versions

template<typename T>
void QList< T >::prepend ( const T &  value  )  [inline, inherited]

Inserts value at the beginning of the list.

Example: doc/src/snippets/code/src_corelib_tools_qlistdata.cpp 7

This is the same as list.insert(0, value).

This operation is usually very fast ({constant time}), because QList preallocates extra space on both sides of its internal buffer to allow for fast growth at both ends of the list.

See also:
append(), insert()

Definition at line 432 of file qlist.h.

References QList< T >::detach().

Referenced by ArchiveExtractor::ArchiveExtractor(), QDBusAbstractInterface::call(), QPictureIO::defineIOHandler(), QGraphicsItem::deviceTransform(), QDirModel::index(), QPatternist::QObjectNodeModel::iterate(), QKeySequence::keyBindings(), QCompleter::pathFromIndex(), TreeModelCompleter::pathFromIndex(), QList< QPostEvent >::push_front(), QCoreApplication::qAddPostRoutine(), QTextCodec::QTextCodec(), QExtensionManager::registerExtensions(), QAbstractXmlForwardIterator< T >::toReversed(), and Uncompressor::Uncompressor().

{
    detach();
    if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
        node_construct(reinterpret_cast<Node *>(p.prepend()), t);
    } else {
        const T cpy(t);
        node_construct(reinterpret_cast<Node *>(p.prepend()), cpy);
    }
}


Generated by  Doxygen 1.6.0   Back to index