Setters and getters(for using pixmap of one class in another)
-
Hi,
Hey i found that the pixmap is empty.Why is this happening?. What am i doing wrong in the getter function?I think there is no problem in the items conversion as i could display the image in the original class which is setMovingImage(...)but not when i return it and access it in another class. I think some how the pixmap becomes null when i return it.
-
have a look at "Implicit Data Sharing ":http://qt-project.org/doc/qt-5.0/qtcore/implicit-sharing.html
even though it seems it should work you could try to use copy() instead of =operator which according to doc does not do a deep copy of pixmap data but just returns a reference untill a paint event occurs on the QPixmap object getting the reference
-
Hey the link is not opening i don't know why. How can i use the copy()it needs some parameters which i don't use in my program. But i am puzzled why doesn't my pixmap contain the image and why is it null?..
-
Hi,
I am sure the problem is with the getData(); i think the other class which receives the pixmap is not receiving the data. Is the problem with the object created in overlayview? -
Hi,
I found out that the object created @StationaryImageViewerObject@ has no information, as i didn't connect it with the @StationaryImageViewer@ though i have created the object i learnt i need to connect it with the StationaryImageViewer class, I am not so sure how to do it but. Would be privileged to have any of your guidances -
@ StationaryImageViewer StationaryImageViewerObject;@
StationaryImageViewerObject is of type StationaryImageViewer ... how do you mean by connecting them?
-
Hi,
The problem is though i have created a object of the class. But i don't know how to make the Qt understand that i am pointing to the particular class.will this help
@
StationaryImageViewer StationaryImageViewer;
@
? -
and btw I have tested returning QPixmap from a function, passing as value or copying by = operator and all work just fine! you're doing something wrong elsewhere :)
-
The problem is it doesn't know which class i am calling, though i am creating an object of the class. It's not getting connected to the class. I am not really sure why is this happening though :(
-
bq. Hi,
The problem is though i have created a object of the class. But i don’t know how to make the Qt understand that i am pointing to the particular class.
will this help
StationaryImageViewer StationaryImageViewer;?
this phrase reveals more about your c++/qt understanding: I think you are still confusing a class type with its instance (in memory created object, static or dynamic) etc. ... better for you to review some c++ stuffs ... qt does not understand anything it's a framework, you could say the compiler does
-
Hmmm, my problem here is how to exactly make the compiler know that i am pointing to the specific class?