I have a class instance that needs to be accessed by some other classes.
- It would be quite cumbersome to pass the instance always down the construction chain.
- I tried to avoid global variable, since people tend to advise against this.
- I thought I declare this instance a static member of a class and then include this class in order to access the instance but this does not work either
error: calling a private constructor of class 'Foo'
To specify the problem further in the context of the QGraphicsView Framework: I want to add QGraphicsItems which are instantiated by a controller class (managing the items) to the QGraphicsScene, which is (but I do not insist on that detail) a member of my QMainWindow class.
I spend a considerable amount of time searching the internet but I am fairly new and am kind of stuck here. I appreciate any incentive on what the best way to solve the dilemma would be.