I just stumbled over it: I have a widget A, which is sort of a container designer widget. It contains some standard elements, and a lot of functionality that is shared across a lot of dialogs I have.

So the obvious solution to me was: subclass A everytime you need a similar dialog and put all the common functionality in A.

To keep the form elements in A, I created an empty "centralWidget" in A. In B's constructor I did:

Qt Code:
  1. B::B(QWidget *parent) : A(parent) {
  2. ui->setupUi(centralWidget);
  3. }
To copy to clipboard, switch view to plain text mode 

This works fine, but auto-connection doesn't work anymore, i.e. void B::on_button1_clicked() was not called anymore.
Solution:

Qt Code:
  1. B::B(QWidget *parent) : A(parent) {
  2. ui->setupUi(centralWidget);
  3. QMetaObject::connectSlotsByName(this);
  4. }
To copy to clipboard, switch view to plain text mode 

There you go. I hope I saved someone some time figuring this out.