Debian Codegraph @

src/imports-compat/Test/MouseTouchAdaptor.qml

raw
1 /*
2 * Copyright (C) 2013,2016 Canonical Ltd.
3 * Copyrigit (C) 2022 UBports Foundation.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 pragma Singleton
19
20 import QtQuick 2.12
21 import Lomiri.Test 1.3 as LT
22
23 QtObject {
24 /*
25 * Since QML doesn't support aliasing singleton, and this property is
26 * read-write, we need to manually sync it. Further, since `enabled`
27 * property exists on Connections type, we can't listen to
28 * LT.MouseTouchAdaptor.enabled directly and need a redirection point.
29 */
30 property bool enabled: LT.MouseTouchAdaptor.enabled
31
32 onEnabledChanged: {
33 if (LT.MouseTouchAdaptor.enabled !== enabled)
34 LT.MouseTouchAdaptor.enabled = enabled;
35 }
36
37 readonly property bool enabledPriv: LT.MouseTouchAdaptor.enabled
38 onEnabledPrivChanged: {
39 if (enabled !== LT.MouseTouchAdaptor.enabled)
40 enabled = LT.MouseTouchAdaptor.enabled;
41 }
42 }