PDA

View Full Version : Qt 3 to Qt 4 port: QList compile errors



Amanda
7th November 2006, 21:42
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

jacek
7th November 2006, 22:03
You can't copy QWidgets, so you can only create a list of pointers --- QList< QWidget * >.

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

Amanda
8th November 2006, 00:11
Thank you again for your help - much appreciated.

Amanda
10th November 2006, 00:43
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

munna
10th November 2006, 05:45
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.