Debian Codegraph @

examples/imageprovider_svg_data.qml

raw
1
2 /**
3 * PyOtherSide: Asynchronous Python 3 Bindings for Qt 5 and Qt 6
4 * Copyright (c) 2011, 2013, Thomas Perl <[email protected]>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
12 * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 **/
18
19 import QtQuick 2.0
20 import io.thp.pyotherside 1.0
21
22 Image {
23 id: image
24 width: 300
25 height: 300
26 sourceSize.width: 300
27 sourceSize.height: 300
28
29 Python {
30 Component.onCompleted: {
31 // Add the directory of this .qml file to the search path
32 addImportPath(Qt.resolvedUrl('.'));
33
34 importModule('imageprovider_svg_data', function () {
35 image.source = 'image://python/python_logo.svg';
36 });
37 }
38
39 onError: console.log('Python error: ' + traceback)
40 }
41 }