- Do away with nested Private classes, ClassFoo::Private and replace them with ClassFooPrivate, this aligns with what Qt upstream is using, and what the newer classes in KF is using. And it also removes the risk of forgetting to use Q_DECL_HIDDEN and having the private symbols exported[1]
- Use a smart pointer to manage the d-pointer, std::unique_ptr (or one of Qt's, e.g. QScopedPointer), instead of calling delete manually in the class's destructor.
- The d-pointer would be forward declared in the header, with d declared as a private member in the class:
private: std::unique_ptr<ClassFooPrivate> d;
And ClassFooPrivate would have a q pointer member:
ClassFoo *const q
This way one can use d->bar() or q->baz() without the need for Q_Q and Q_D macros. Those macros are still useful for classes where the Private class of the sub-class inherits from the one in the base class, see https://phabricator.kde.org/T13924#246220 for details.
[1] https://mail.kde.org/pipermail/kde-frameworks-devel/2015-August/025956.html