Results 1 to 2 of 2

Thread: QLinkedList and iterators

  1. #1
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QLinkedList and iterators

    Hi,

    What is wrong with the following code?

    Qt Code:
    1. #include <QLinkedList>
    2. #include <QListIterator>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QLinkedList<QString> listProjName;
    7. QListIterator<QString> iLPN(listProjName);
    8. QLinkedList<int> listProjID;
    9. QListIterator<int> iLPID(listProjID);
    10. ...
    11. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp: In function `int qMain(int, char**)':
    main.cpp:29: error: no matching function for call to `QListIterator<QString>::QL
    istIterator(QList<QString>*)'
    C:/Qt/4.2.2/include/QtCore/../../src/corelib/tools/qlist.h:644: note: candidates
    are: QListIterator<QString>::QListIterator(const QListIterator<QString>&)
    C:/Qt/4.2.2/include/QtCore/../../src/corelib/tools/qlist.h:644: note:
    QListIterator<T>::QListIterator(const QList<T>&) [with T = QString]
    ...

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,709
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLinkedList and iterators

    Try using QLinkedListIterator.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.