Update the signal and slots docs
This lifts the documentation into a more recent context. One might argue that Qt is a little bit older too. Change-Id: I3e85f21bbad1179136629c2025e3499481fc8334 Task-number: QTBUG-16809 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
This commit is contained in:
parent
24edd8afdc
commit
9c464c3bf4
@ -49,17 +49,14 @@
|
|||||||
if a user clicks a \uicontrol{Close} button, we probably want the
|
if a user clicks a \uicontrol{Close} button, we probably want the
|
||||||
window's \l{QWidget::close()}{close()} function to be called.
|
window's \l{QWidget::close()}{close()} function to be called.
|
||||||
|
|
||||||
Older toolkits achieve this kind of communication using
|
Other toolkits achieve this kind of communication using
|
||||||
callbacks. A callback is a pointer to a function, so if you want
|
callbacks. A callback is a pointer to a function, so if you want
|
||||||
a processing function to notify you about some event you pass a
|
a processing function to notify you about some event you pass a
|
||||||
pointer to another function (the callback) to the processing
|
pointer to another function (the callback) to the processing
|
||||||
function. The processing function then calls the callback when
|
function. The processing function then calls the callback when
|
||||||
appropriate. Callbacks have two fundamental flaws: Firstly, they
|
appropriate. While successful frameworks using this method do exist,
|
||||||
are not type-safe. We can never be certain that the processing
|
callbacks can be unintuitive and may suffer from problems in ensuring
|
||||||
function will call the callback with the correct arguments.
|
the type-correctness of callback arguments.
|
||||||
Secondly, the callback is strongly coupled to the processing
|
|
||||||
function since the processing function must know which callback
|
|
||||||
to call.
|
|
||||||
|
|
||||||
\section1 Signals and Slots
|
\section1 Signals and Slots
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user