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()’
b.size();
@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?
-
Hi,
Do you mean something like:
@b = A@
vs
@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 ?
-
-
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....