Saturday 21 April 2018

QT

Qt widely uses inheritance, especially in the Widgets module. The following graph shows some of these inheritances:
Beginner-Class-Hierarchy.jpg

 All widgets inherit from QObject. The most basic widget is the QWidget. QWidget contains most properties that are used to describe a window, or a widget, like position and size, mouse cursor, tooltips, etc.



  • signal is a message that an object can send, most of the time to inform of a status change.
  • slot is a function that is used to accept and respond to a signal.

Features of signals and slots

  • A signal can be connected to several slots
  • Many signals can be connected to a slot

We need to write the keyword emit to send the signal.
Connecting the newly created signal to the quit slot is done as usual:
connect(this, SIGNAL (counterReached()), QApplication::instance(), SLOT (quit()));

No comments:

Post a Comment