Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Binary Compatibility Workarounds: Difference between revisions
Jump to navigation
Jump to search
Olivier M. (talk | contribs) No edit summary |
Olivier M. (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Developing_Qt]] | [[Category:Developing_Qt]] | ||
Revision as of 08:23, 26 May 2015
This page describes some workarounds for keeping binary compatibility in patch releases. You should read the KDE reference: Binary Compatibility Issues with C++.
Declaring a slot for private classes (d-pointer)
Use a Q_PRIVATE_SLOT:
class A: public QObject
{
Q_OBJECT
…
private:
Q_PRIVATE_SLOT(d_func(), void myPrivateSlot())
};
/* in .cpp file */
void APrivate::myPrivateSlot() {…}
#include "moc_a.cpp"
Pitfalls to avoid:
- Don't include `a.moc`, but `moc_a.cpp` in your .cpp file
- Q_PRIVATE_SLOT takes the complete signature of the private slot, not just its name