diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2022-10-12 15:56:00 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-12-07 13:50:01 +0100 |
commit | ee9e3a10d967874eddc5400b2b7aa36950140b9b (patch) | |
tree | 0765f56ac0ea367140b241235eb571b295d152d1 /src/qml/CMakeLists.txt | |
parent | a354d91b885b16e6246d7ff166244b31d33f56a7 (diff) | |
download | qtdeclarative-ee9e3a10d967874eddc5400b2b7aa36950140b9b.tar.gz |
qmltc: fix handlers for c++-signals
Allow qmltc to generate handlers for c++-defined signals with const
parameters by changing the safeguard to avoid type mismatch between
slots and signals.
First, remove the qOverload in the generated QObject::connect call to
be able the connect slots and signals with different types (namely,
pass by const references and pass by value should be interchangeable but
is not allowed by qOverload).
Second, save in QQmlJSMetaParameter when types are passed by pointer.
Like this, qqmljsimportvisitor can check if a value type is indeed
passed by value or const reference in a C++ signal. The same for reference
types that need to be passed by (const and non-const) pointer.
Print a message when an type is passed by argument in an incompatible
way instead of letting qmltc generate uncompilable code, which makes the
compiler print out cryptical messages.
Third, add a qqmlcpptypehelpers template that decides if value types
should be passed by value or reference, by letting the c++ compiler
check if sizeof(T) > 3*sizeof(void*).
Fixes: QTBUG-107625
Fixes: QTBUG-107622
Change-Id: I1a00532df591d10f74c1fd00dff5b7fccf40cb22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/CMakeLists.txt')
-rw-r--r-- | src/qml/CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 5781b03573..686c9dfb24 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -359,6 +359,7 @@ qt_internal_add_qml_module(Qml qmltc/supportlibrary/qqmlcppbinding.cpp qmltc/supportlibrary/qqmlcpponassignment_p.h qmltc/supportlibrary/qqmlcpponassignment.cpp + qmltc/supportlibrary/qqmlcpptypehelpers_p.h DEFINES BUILDING_QT__ ENABLE_ASSEMBLER_WX_EXCLUSIVE=1 |