Wild Beasts

In “Private Practice: Taming Templates”, I had (deliberately, of course :)) hidden a bug in the implementation of KDGenericFactory. I’ve now added a discussion about the bug and its fix.

Effective Qt: Prefer to use normalised signal/slot signatures

The second of my Effective Qt columns, “Prefer to use normalised signal/slot signatures“, just went live on my site.

There is only one guideline this item covers:

  • Prefer normalised signal/slot signatures in connect statements.

Hope you enjoy!

Effective Qt: Don’t be sub-class when subclassing

The first of my Effective Qt columns, “Don’t be sub-class when subclassing“, just went live on my site.

Here are the guidelines this item covers:

  • When subclassing QObject (directly or indirectly), always add the Q_OBJECT macro, regardless of whether you also define signals or slots.
  • Prefer to offer all base class constructors in subclasses, too.
  • Prefer to offer the basic QObject constructor ( QObject * parent=0 ) when subclassing QObjects. Always offer the basic QWidget constructor ( QWidget * parent=0, Qt::WindowFlags f=0 ) when subclassing QWidget.
  • Prefer to follow the Qt constructor pattern: When inheriting QObjects, end constructor argument lists in QObject * parent=0. When inheriting QWidgets, end constructor argument lists in QWidget * parent=0, Qt::WindowFlags f=0. Add additional arguments at the beginning of the argument list.

I hope to make this into a regular column, time permitting.

Advertisement