diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-10-11 17:45:43 +0200 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-11-22 17:00:11 +0000 |
commit | a57a202a70801f766094c3ed11664b03c9a6a3e4 (patch) | |
tree | 73c2c1f4fc902ccbc10b73811bbf299a2c555728 /sources/pyside2/PySide2/glue/qtqml.cpp | |
parent | f93a7369657814206bfbce49817c8fbd9a1bfcba (diff) |
Move inject-code snippets to separate files
When code must be modified or added to certain
functions, we currently have two options:
* Write a template and include it into the typesystem,
* inject code directly at a certain place of the function entry.
The problem with injecting raw code is that since it is an XML
file, one need to escape protected symbols, like "<" and "&".
Thanks to a couple of complementary commits, now we can place
this code snippets on a separate file without triggering
a whole module compiling process, since the typesystem itself
will not be alterered.
All the injected code from the typesystem was removed
and placed into a single file per module inside a top-level directory
called glue.
Some small fixes were included mainly regarding styling
of the code.
Task-number: PYSIDE-834
Change-Id: I823e92d241a528d75d5940090008db9bf297f49e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/glue/qtqml.cpp')
-rw-r--r-- | sources/pyside2/PySide2/glue/qtqml.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/glue/qtqml.cpp b/sources/pyside2/PySide2/glue/qtqml.cpp new file mode 100644 index 000000000..1913204c3 --- /dev/null +++ b/sources/pyside2/PySide2/glue/qtqml.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Python. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// @snippet qmlregistertype +int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES); +%PYARG_0 = %CONVERTTOPYTHON[int](%0); +// @snippet qmlregistertype + +// @snippet init +PySide::initQmlSupport(module); +// @snippet init + +// @snippet qjsengine-toscriptvalue +%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1); +return %CONVERTTOPYTHON[%RETURN_TYPE](retval); +// @snippet qjsengine-toscriptvalue |