Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/kcm/libinput/components/ToolTip.qml
- This file was moved from kcms/input/mousesettings.h.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright 2017 Xuetian Weng <wengxt@gmail.com> | 2 | * Copyright 2017 Roman Gilg <subdiff@gmail.com> | ||
3 | * | 3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | 7 | * (at your option) any later version. | ||
8 | * | 8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #ifndef MOUSESETTINGS_H | 19 | import QtQuick 2.7 | ||
20 | #define MOUSESETTINGS_H | | |||
21 | 20 | | |||
22 | #include <KConfig> | 21 | import QtQuick.Controls.Private 1.0 | ||
23 | 22 | | |||
24 | class MouseBackend; | 23 | MouseArea { | ||
24 | anchors.fill: parent | ||||
25 | 25 | | |||
26 | enum class MouseHanded { | 26 | property string text: "" | ||
27 | Right = 0, | | |||
28 | Left = 1, | | |||
29 | NotSupported = -1 | | |||
30 | }; | | |||
31 | | ||||
32 | struct MouseSettings | | |||
33 | { | | |||
34 | void save(KConfig *); | | |||
35 | void load(KConfig *, MouseBackend*); | | |||
36 | void apply(MouseBackend*, bool force = false); | | |||
37 | | ||||
38 | bool handedEnabled; | | |||
39 | bool handedNeedsApply; | | |||
40 | MouseHanded handed; | | |||
41 | double accelRate; | | |||
42 | int thresholdMove; | | |||
43 | int doubleClickInterval; | | |||
44 | int dragStartTime; | | |||
45 | int dragStartDist; | | |||
46 | bool singleClick; | | |||
47 | int wheelScrollLines; | | |||
48 | bool reverseScrollPolarity; | | |||
49 | QString currentAccelProfile; | | |||
50 | }; | | |||
51 | 27 | | |||
52 | #endif // MOUSESETTINGS_H | 28 | hoverEnabled: true | ||
29 | acceptedButtons: Qt.NoButton | ||||
30 | | ||||
31 | onEntered: timer.start() | ||||
32 | onExited: timer.killTooltip() | ||||
33 | onPositionChanged: timer.resetTooltip() | ||||
34 | | ||||
35 | Timer { | ||||
36 | id: timer | ||||
37 | interval: 1000 | ||||
38 | onTriggered: { | ||||
39 | Tooltip.showText(parent, Qt.point(mouseX, mouseY), text) | ||||
40 | } | ||||
41 | | ||||
42 | function killTooltip() { | ||||
43 | stop() | ||||
44 | Tooltip.hideText() | ||||
45 | } | ||||
46 | | ||||
47 | function resetTooltip() { | ||||
48 | restart() | ||||
49 | Tooltip.hideText() | ||||
50 | } | ||||
51 | } | ||||
52 | } |