Hi! I've been stuck with this for hours, I don't know why I'm doing this wrong, can't understand.
What I want to do is to create a method that returns a QImage, and pass this QImage not a the return type, but as a parameter of the method (I know I can do it other ways, but I really would like to learn why this is wrong and how it should be done).
This is more or less what I did:

Qt Code:
  1. QImage myImage;
  2. myMethod(myImage);
To copy to clipboard, switch view to plain text mode 

where myMethod is defined as:

Qt Code:
  1. bool MyClass::myMethod(QImage& myImage)
  2. {
  3. ...
  4. myImage = QImage::fromData(...);
  5. ...
  6. return true;
  7. }
To copy to clipboard, switch view to plain text mode 

I thought that implicit sharing used this way should have assigned the new image to my myImage which, being passed by reference, is my original image. Unfortunately this is wrong as I can see. Why?

Thanks!