Signals and slots of Qt in C++

Signals and slots of Qt in C++

  The signal slot is one of the mechanisms that the Qt framework is proud of. The so-called signal slot is actually the observer mode. When an event occurs , for example, the button detects that it has been clicked, it will send out a signal (signal) . This kind of transmission is purposeless, similar to broadcasting. If an object is interested in this signal, it will use the connect function , which means that it binds the signal it wants to handle with a function of its own (called a slot) to process this signal . In other words, when the signal is sent, the connected slot function will automatically be called back . This is similar to the observer mode: when an event of interest occurs, an operation will be automatically triggered.

  Signals and slots are Qt's unique information transmission mechanism and an important basis for Qt's design program. It allows objects that do not interfere with each other to establish a connection.

  The essence of a slot is a member function of a class, and its parameters can be of any type. It is almost the same as a normal C++ member function. It can be a virtual function; it can also be overloaded; it can be public, protected, private, and can also be called by other C++ member functions. The only difference is that a slot can be connected to a signal, and this slot is called whenever a signal connected to the slot is emitted.

 

https://blog.csdn.net/sessos/article/details/88247738

Guess you like

Origin blog.csdn.net/txwtech/article/details/106842207