Hi,

I have a class which contains two objects whose classes are both derived from QGraphicsItem. I would like to reach them outside without setting these members public. In codes speaking it is something like this:
Qt Code:
  1. class myClass
  2. {
  3. public: // ... and here I need some functions like getVar1() or getVat2()
  4. private:
  5. // ...
  6. c1 * var1; // c1 : public QGraphicsItem
  7. c2 * var2; // c2 : public QGraphicsItem
  8. }
To copy to clipboard, switch view to plain text mode 

It could be also fine to get them in a QGraphichScene object, but a function like below does not work because the copy constructor is private.
Qt Code:
  1. QGraphicsScene myClass::getMyScene()
  2. {
  3. temp.addItem(var1);
  4. temp.addItem(var2);
  5. return temp;
  6. }
To copy to clipboard, switch view to plain text mode 

I've also tried this:
Qt Code:
  1. void setMyScene(QGraphicsScene & sc)
  2. {
  3. sc.addItem(var1);
  4. }
To copy to clipboard, switch view to plain text mode 
but this does not seem to do anything to a "QGraphicsScene scene" variable. Frankly speaking it work like this:
Qt Code:
  1. di->setMyScene(scene[0]);
  2. ui->graphicsView->setScene(scene);
To copy to clipboard, switch view to plain text mode 
But this solution does not really look correct to me. Well, works, but still...
What would you suggest?