1 // This is the initialisation support code for the QtQuick module.
2 //
3 // Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
4 //
5 // This file is part of PyQt5.
6 //
7 // This file may be used under the terms of the GNU General Public License
8 // version 3.0 as published by the Free Software Foundation and appearing in
9 // the file LICENSE included in the packaging of this file.  Please review the
10 // following information to ensure the GNU General Public License version 3.0
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 //
13 // If you do not wish to use this file under the terms of the GPL version 3.0
14 // then you may purchase a commercial license.  For more information contact
15 // info@riverbankcomputing.com.
16 //
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 
20 
21 #include "qpyquick_api.h"
22 #include "qpyquick_chimera_helpers.h"
23 #include "qpyquick_register_type.h"
24 
25 #include "sipAPIQtQuick.h"
26 
27 
28 // Imports from QtCore.
29 pyqt5_qtquick_err_print_t pyqt5_qtquick_err_print;
30 
31 
32 // Perform any required initialisation.
qpyquick_post_init()33 void qpyquick_post_init()
34 {
35     // Import the Chimera helper registration functions.
36     void (*register_from_qvariant_convertor)(FromQVariantConvertorFn);
37     register_from_qvariant_convertor = (void (*)(FromQVariantConvertorFn))sipImportSymbol("pyqt5_register_from_qvariant_convertor");
38     Q_ASSERT(register_from_qvariant_convertor);
39     register_from_qvariant_convertor(qpyquick_from_qvariant_convertor);
40 
41     void (*register_to_qvariant_convertor)(ToQVariantConvertorFn);
42     register_to_qvariant_convertor = (void (*)(ToQVariantConvertorFn))sipImportSymbol("pyqt5_register_to_qvariant_convertor");
43     Q_ASSERT(register_to_qvariant_convertor);
44     register_to_qvariant_convertor(qpyquick_to_qvariant_convertor);
45 
46     void (*register_to_qvariant_data_convertor)(ToQVariantDataConvertorFn);
47     register_to_qvariant_data_convertor = (void (*)(ToQVariantDataConvertorFn))sipImportSymbol("pyqt5_register_to_qvariant_data_convertor");
48     Q_ASSERT(register_to_qvariant_data_convertor);
49     register_to_qvariant_data_convertor(qpyquick_to_qvariant_data_convertor);
50 
51     // Other QtCore imports.
52     pyqt5_qtquick_err_print = (pyqt5_qtquick_err_print_t)sipImportSymbol(
53             "pyqt5_err_print");
54     Q_ASSERT(pyqt5_qtquick_err_print);
55 
56     // Export the qml_register_type() helper.
57     sipExportSymbol("qtquick_register_item", (void *)qpyquick_register_type);
58 }
59