Results 1 to 5 of 5

Thread: Qt 3 to Qt 4 port: QList compile errors

  1. #1
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt 3 to Qt 4 port: QList compile errors

    Hi,

    I'm nearly done with a Qt 3 to Qt 4 porting project.

    I get the following QList compile errors. How can I do these calls in Qt 4? Or do I need to use QListPtr instead (I'm trying to avoid that option because it will require a lot of code changes)?

    error: 'class QList<QWidget>' has no member named 'findRef'
    error: 'class QList<QWidget>' has no member named 'next'
    error: 'class QList<QWidget>' has no member named 'prev'
    error: 'class QList<QWidget>' has no member named 'removeRef'
    error: no matching function for call to `QList<QWidget>::append(QWidget*&)'
    error: no matching function for call to `QList<QWidget>:: prepend(QWidget*&)'

    Thanks,
    Amanda

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 3 to Qt 4 port: QList compile errors

    You can't copy QWidgets, so you can only create a list of pointers --- QList< QWidget * >.

    As for the next() and prev(): use QListIterator.

  3. The following user says thank you to jacek for this useful post:

    Amanda (8th November 2006)

  4. #3
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 3 to Qt 4 port: QList compile errors

    Thank you again for your help - much appreciated.

  5. #4
    Join Date
    Oct 2006
    Location
    San Francisco, USA
    Posts
    14
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt 3 to Qt 4 port: QList compile errors

    Hi again,

    I am now using class QList<QWidget*> but still have an issue with the following methods because they are unsupported in Qt 4 (they were in the Qt 3 API):

    findRef()
    removeRef()

    Do I need to use QListPtr to get the same functionality in Qt 4, or is there another approach?

    Thanks,
    Amanda

  6. #5
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 3 to Qt 4 port: QList compile errors

    You can use

    int indexOf( const T & value, int from = 0 ) const //Find the index of the item

    and

    T takeAt(int i )//Remove the item from the list.

  7. The following user says thank you to munna for this useful post:

    Amanda (10th November 2006)

Similar Threads

  1. Compile Errors
    By luffy27 in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 05:26
  2. Qt compilation errors
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 31st October 2006, 17:29
  3. Accessing QList Objects
    By magikalpnoi in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2006, 20:43
  4. Qt Compile Errors?
    By magikalpnoi in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2006, 22:18

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.