qt5base-lts/tests/auto/gui
Kent Hansen 9e92ecde74 Provide API for "placement new" construction of meta-types
By making it possible to specify the place in memory where a
type should be constructed, any meta-type can be allocated on
the stack, for example. In the QML/JS QObject binding, this
makes it possible to call slots and access properties from
JavaScript without having to perform any mallocs (e.g. due to
QVariant creation) in the C++ <--> JS value conversion, in
the best case.

In addition to QMetaType::construct() and QMetaType::destruct(),
this change introduces QMetaType::typeSize(), which returns the
size of a type in bytes. This can be used to prepare a suitable
buffer for constructing a type using construct().

Benchmarks indicate that in-place construction is 2-5x faster
than normal construction for core and GUI types on linux-g++.

Note that there is already a QMetaType::construct() function
in Qt 4, which has been renamed to QMetaType::create() in Qt 5.
In order to avoid existing usages of construct() in user code
to call the Qt 5 construct() (when they really meant to call
create()), the third argument ("copy") of construct() is made
mandatory. Hence, calls to QMetaType::construct() written for
Qt 4 will cause a compile error when compiled with Qt 5, and
the user must adapt his code.

Task-number: QTBUG-12574
Change-Id: I836f06f6ee1c1c3edbd199a03424c78c942bdd3e
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2011-10-19 10:25:28 +02:00
..
image Prevent QPixmapCache potentially growing indefinitely. 2011-10-03 11:55:32 +02:00
kernel Provide API for "placement new" construction of meta-types 2011-10-19 10:25:28 +02:00
math3d Moved gui autotests into new directory structure 2011-09-01 10:59:49 +02:00
painting Remove DEPENDS_ON from qtestlib API. 2011-10-19 07:24:13 +02:00
text Clean-up a macro for Cocoa 2011-10-10 07:47:58 +02:00
util Remove Symbian-specific code from tests. 2011-09-29 06:41:42 +02:00
gui.pro Moved gui autotests into new directory structure 2011-09-01 10:59:49 +02:00