@Dariusz said in QT Sdk - practive, can one private object access another one?:
Would it not make sense if a private class can access other widget's private classes?
No. Private is there for a reason. Private stuff should not be accesed directly by the outside world.
If there is no public API yet for something and it is really needed, then it needs to be added. But this is not a reason to break encapsulating by allowing direct access to private APIs.
Also, in C++ you can't access private members/methods from other classes without making these classes friends. Nothing Qt can do about (and it also should not).
And as @SGaist pointed out: the PIMPL design pattern is there to prevent ABI from changing if internal implementation changes. Means: if you change something in the private implementation without changing public API, then the user code does not have to be rebuilt. Since you can't restrict access to private APIs to private classes (like what your example shows: widget->getPrivate()) also non-private classes would be able to access those interfaces and (even worse) user code.