Debian Codegraph @

examples/imageprovider_example.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
27 Python {
28 Component.onCompleted: {
29 // Add the directory of this .qml file to the search path
30 addImportPath(Qt.resolvedUrl('.'));
31
32 importModule('imageprovider_example', function () {
33 image.source = 'image://python/image-id-passed-from-qml';
34 });
35 }
36
37 onError: console.log('Python error: ' + traceback)
38 }
39 }