--nextPart1883401.WLRbpIFnrF Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, while we're on the topic of public APIs and kdelibs cleanups: Here's a neat= =20 little moc trick that we use in Qt 4 and that we can very well also use in= =20 kdelibs. It is very common to need slots in public classes. Take KDateWidget for=20 example: =2E.. protected Q_SLOTS: void slotDateChanged(); =2E.. private: KDateWidgetPrivate *d; =2E.. This slot is not intended for applications to call/use and it is connected = to=20 the internal widgets. There's no need to have it in the public API and=20 exported. You can use the following instead: =2E.. private: Q_PRIVATE_SLOT(d, void slotDateChanged()) KDateWidgetPrivate *d; =2E.. This macro expands to nothing but moc reads it nevertheless. It will genera= te=20 a slot with the given signature in the metaobject, so you can connect to it= =2E=20 But it assumes that the method itself is a member function of the first=20 argument of the macro. So the generated code will look like =2E.. [deep in the metacall ] d->slotDateChanged(); =2E.. If that moc generated code is included from within the .cpp file (like we=20 fortunately do most of the time in KDE) d is well-defined and the compiler= =20 can call your private slot, which is now just a member function of your d=20 pointer. And of course in general I suggest not to have any private methods in our=20 public API at all. Putting it into your d-pointer gives you more flexibilit= y=20 in the future to change the implementation. There is really no good reason= =20 for exporting private functions. I've heard gcc 4.2 will apply the default (hidden) visibility to private=20 members, so they won't exported anymore. But I hope that at some point in t= he=20 future we can provide binary compatibility in kdelibs with more than just g= cc=20 > 4.2 :) Simon --nextPart1883401.WLRbpIFnrF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBFm8ZOWXvMThJCpvIRAorAAKDpsQ3iJGmi21TOHBZs85FzzBq39ACg5R++ D6+5vNb7qRZTuho5H3IAJdM= =E5iI -----END PGP SIGNATURE----- --nextPart1883401.WLRbpIFnrF--