If you're using QtCreator's Designer, one of the outputs from this is a .ui
file
Qt Designer ui files are an XML representation of your form's widget tree, and are processed by uic
, the "User Interface Compiler"
One of the features provided by Qt's ui format is AutoConnect.
uic
automatically generates code in the form's setupUi()
function to connect your signals and slots.
The way it works is as follows:
Your slots must conform to the following format:
void on_<object-name>_<signal-name>(<signal-parameters>);
where object-name
is the name of the object which emits the signal this slot is for.
Later, uic
then generates code which calls QMetaObject::connectSlotsByName(this);
Using Qt's reflection system, the QObject
which has objectName()
=object-name
is found, and it's signal is connected to your slot.