Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Qt 5

You're reading from   Getting Started with Qt 5 Introduction to programming Qt 5 for cross-platform application development

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781789956030
Length 136 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Benjamin Baka Benjamin Baka
Author Profile Icon Benjamin Baka
Benjamin Baka
Arrow right icon
View More author details
Toc

Signals and slots

In Qt, this action-response scheme is handled by signals and slots. This section will include a few definitions, and then we shall jump into an example for further explanation.

A signal is a message that is passed to communicate that the state of an object has changed. This signal may carry information about the change that has occurred. For instance, when a window has been resized, the signal will usually carry the coordinates of the new state (or size) of the window. Sometimes, a signal may carry no extra information, such as that of a button click.

A slot is a specific function of an object that is called whenever a certain signal has been emitted. Since slots are functions, they will embody lines of code that perform an action, such as closing a window, disabling a button, and sending an email, to mention but a few.

Signals and slots have to be connected...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime