Do QGrahpicsItems need to be dynamicall allocated?
I'm working on porting my PyQt app to C++, I've always run into a few bumps here and there, but for the most part it's been pretty smooth. The app makes heavy use of the QGraphicsView Framework.
So let's say I had an object "A," that is a sublcass of "QGraphicsObject," A has a method ".size()," which will return a QSize. It also has some calls to qDebug() in its constructor.
When I made a static instance of A (identified by "b,"), I didn't see any output on the terminal and I got an error like this:
@main.cpp:22:4: error: request for member ‘info’ in ‘b’, which is of non-class type ‘A()’
When I did a dynamically allocated instance, it worked fine and I saw a message on the terminal.
Can someone explain what's up with this here?
Do you mean something like:
@b = A@
@b = A()@
The second one.
My question was not clear enough.
Can you post the code that is failing and then one that is successful ?
When I do:
The complilation fails.
If I do:
(Using either default or no parameters), it works out fine.
And if I do:
@A *b = new A(/parameters/);@
It works fine.
Ok, it's clearer now, I've misread your initial post…
What parameters are you giving that makes it fail ?
It might be because I forogt to add the "explicit," keyword to my constrcutors. My Bad....