Thomas Wrobel
26th November 2009, 20:18
I'm probably getting my pointers all in a muddle here.
I wish to have a set of QHBoxLayouts stored so I can retrieve them and change elements within them. (later Id probably use my own class rather then QHBoxLayouts).
Now, I'm assuming I want to store an array of pointers to the objects, so they can be edited and updated easily. (with the results seen on screen straight away).
However, my code is crashing when I trigger the function to add an element into the array, so I'm probably doing something wrong there.
QHBoxLayout* ArBlipContainer = new QHBoxLayout();
QHBoxLayout* pointerb;
pointerb = ArBlipContainer;
ArBlipContainers->append(pointerb);
I'm pretty sure I don't need the pointer variable at all, but was using it to try to debug.
Either way I get the same result by dumping ArBlipContainer into the append parameter instead.
Commenting out that last line prevents the crash.
ArBlipContainers is defined as;
QList<QHBoxLayout *> *ArBlipContainers; //add the blips known to the system
In the private section of the *.h file.
I apologise if I'm making all sorts of obvious mistakes, I'm migrating from java development, so all this pointer business is new to me :)
(or rather, I guess the ability to not have pointers is)
I wish to have a set of QHBoxLayouts stored so I can retrieve them and change elements within them. (later Id probably use my own class rather then QHBoxLayouts).
Now, I'm assuming I want to store an array of pointers to the objects, so they can be edited and updated easily. (with the results seen on screen straight away).
However, my code is crashing when I trigger the function to add an element into the array, so I'm probably doing something wrong there.
QHBoxLayout* ArBlipContainer = new QHBoxLayout();
QHBoxLayout* pointerb;
pointerb = ArBlipContainer;
ArBlipContainers->append(pointerb);
I'm pretty sure I don't need the pointer variable at all, but was using it to try to debug.
Either way I get the same result by dumping ArBlipContainer into the append parameter instead.
Commenting out that last line prevents the crash.
ArBlipContainers is defined as;
QList<QHBoxLayout *> *ArBlipContainers; //add the blips known to the system
In the private section of the *.h file.
I apologise if I'm making all sorts of obvious mistakes, I'm migrating from java development, so all this pointer business is new to me :)
(or rather, I guess the ability to not have pointers is)