Signal to slot in QT Creator where is the connect () function?

In QT Creator, design mode, I right click on the widget and select Go to Slot and create a slot function for one of the widget signals. I would have thought this would create a function connect()

to create this connection, however I cannot find anything like it in any of the source code. Where is the actual code that connects the widget signal to the slot function? thank

+3


source to share


1 answer


If you are using QtCreator Designer one of the outputs from this file is .ui

Qt Designer ui files are an XML representation of the form widget tree and are processed uic

by the "UI Compiler"

One of the features provided by the Qt ui format is AutoConnect .

uic

automatically generates code in the form setupUi()

to connect your signals and slots.

How it works:



Your slots must follow the following format:

void on_<object-name>_<signal-name>(<signal-parameters>);

      

where object-name

is the name of the object that emits the signal for which this slot is intended.

It later uic

then generates code that callsQMetaObject::connectSlotsByName(this);

Using Qt's reflection system, found QObject

which has objectName()

= object-name

and that signal is connected to your slot.

+3


source







All Articles