taraj
23rd June 2011, 02:23
Hi,
I am converting a Qt3 App to Qt4 (Qt4.7.1).
I have a class:
class AbstractThing : public QPushButton
In Qt3 I had a
class NodeManager : public QObject, QPtrList<AbstractThing>
I have converted this in Qt4 to
class NodeManager : public QObject, QList<AbstractThing*>
I have a function in NodeManager that looks at the items in the QList, in Qt3 I had
void NodeManager::doStuff()
AbstractThing *thing;
for(thing = first(); thing; thing = next())
{
//stuff
}
In Qt4 next() is no longer in Qlist so i have decided to use a QListIterator
QListIterator<AbstractThing *> it();
AbstractThing *thing = first();
while (it.hasNext())
{
thing.setDown(false)
}
But what do i put in the empty ()? I can't put 'this'
Or will i be better doing a count on the list and a for(int i = 0 .... with item.at(i) etc...
Thank you
Tara
I am converting a Qt3 App to Qt4 (Qt4.7.1).
I have a class:
class AbstractThing : public QPushButton
In Qt3 I had a
class NodeManager : public QObject, QPtrList<AbstractThing>
I have converted this in Qt4 to
class NodeManager : public QObject, QList<AbstractThing*>
I have a function in NodeManager that looks at the items in the QList, in Qt3 I had
void NodeManager::doStuff()
AbstractThing *thing;
for(thing = first(); thing; thing = next())
{
//stuff
}
In Qt4 next() is no longer in Qlist so i have decided to use a QListIterator
QListIterator<AbstractThing *> it();
AbstractThing *thing = first();
while (it.hasNext())
{
thing.setDown(false)
}
But what do i put in the empty ()? I can't put 'this'
Or will i be better doing a count on the list and a for(int i = 0 .... with item.at(i) etc...
Thank you
Tara