Setters and getters(for using pixmap of one class in another)
-
Or you are checking for
@OpacityViewMovingPixmap_=MovingImageViewerObject.getMovingImagePixmap();@
Try after that the null condition. -
Hi,
beside checking if pixmap is null you could print out MovingImagePath_ ... may be there is something wrong with the item's data and conversion from QVariant?
-
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
-
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?
-
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 :)
-
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