blob: be647ca57f9010612e3a919b3cbaba733cfcf3c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import QtQuick 2.0
import Qt.test 1.0 as QtTest // qobject module API installed into existing uri
QtObject {
property int firstProperty: 1
property int secondProperty: 2
property int readOnlyProperty: QtTest.qobjectTestProperty
property int writableProperty: QtTest.qobjectTestWritableProperty
onFirstPropertyChanged: {
// In this case, we want to attempt to set the module API property.
// This should fail, as the module API property is read only.
if (firstProperty != QtTest.qobjectTestProperty) {
QtTest.qobjectTestProperty = firstProperty; // should silently fail.
}
}
onSecondPropertyChanged: {
// In this case, we want to attempt to set the module API property.
// This should succeed, as the module API property is writable.
if (secondProperty != QtTest.qobjectTestWritableProperty) {
QtTest.qobjectTestWritableProperty = secondProperty; // should succeed.
}
}
}
|