Fix Mandelbrot Example documentation with regards to qRegisterMetaType()

The call to qRegisterMetaType() has been removed since the type
is registered as a meta type in Qt 5. Assert on the meta type id instead.
Adapt the documentation accordingly.

Fixes: QTBUG-81254
Change-Id: I0cb459d0dda7a82fc37871605ff634004af0f9f9
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Friedemann Kleint 2020-01-13 11:20:14 +01:00
parent f936ca4f86
commit caab0ad357

View File

@ -238,8 +238,7 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 1 \snippet threads/mandelbrot/mandelbrotwidget.cpp 1
The interesting part of the constructor is the The interesting part of the constructor is the
qRegisterMetaType() and QObject::connect() calls. Let's start QObject::connect() call.
with the \l{QObject::connect()}{connect()} call.
Although it looks like a standard signal-slot connection between Although it looks like a standard signal-slot connection between
two \l{QObject}s, because the signal is emitted in a different two \l{QObject}s, because the signal is emitted in a different
@ -254,9 +253,10 @@
With queued connections, Qt must store a copy of the arguments With queued connections, Qt must store a copy of the arguments
that were passed to the signal so that it can pass them to the that were passed to the signal so that it can pass them to the
slot later on. Qt knows how to take of copy of many C++ and Qt slot later on. Qt knows how to take of copy of many C++ and Qt
types, but QImage isn't one of them. We must therefore call the types, so, no further action is needed for QImage.
template function qRegisterMetaType() before we can use QImage If a custom type was used, a call to the template function
as a parameter in queued connections. qRegisterMetaType() would be required before the type
could be used as a parameter in queued connections.
\snippet threads/mandelbrot/mandelbrotwidget.cpp 2 \snippet threads/mandelbrot/mandelbrotwidget.cpp 2
\snippet threads/mandelbrot/mandelbrotwidget.cpp 3 \snippet threads/mandelbrot/mandelbrotwidget.cpp 3