Changeset View
Changeset View
Standalone View
Standalone View
qml/virtualkeyboard/main.qml
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 2.3 | ||||
21 | import QtQuick.VirtualKeyboard 2.1 | 22 | import QtQuick.VirtualKeyboard 2.1 | ||
22 | 23 | | |||
23 | Item { | 24 | Item { | ||
24 | id: window | 25 | id: window | ||
26 | property real adjustment: 0 | ||||
27 | property real adjustmentFactor: 0.0 | ||||
25 | InputPanel { | 28 | InputPanel { | ||
26 | id: inputPanel | 29 | id: inputPanel | ||
27 | objectName: "inputPanel" | 30 | objectName: "inputPanel" | ||
28 | anchors.left: parent.left | 31 | width: parent.width - parent.width * parent.adjustmentFactor | ||
29 | anchors.right: parent.right | 32 | anchors.horizontalCenter: parent.horizontalCenter | ||
30 | anchors.bottom: parent.bottom | 33 | anchors.bottom: parent.bottom | ||
31 | } | 34 | } | ||
35 | ToolButton { | ||||
36 | id: resizeButton | ||||
37 | flat: true | ||||
38 | display: AbstractButton.IconOnly | ||||
39 | icon.name: "transform-scale" | ||||
40 | icon.color: "white" | ||||
41 | down: mouseArea.pressed | ||||
42 | | ||||
43 | anchors { | ||||
44 | right: inputPanel.right | ||||
45 | top: inputPanel.top | ||||
46 | } | ||||
47 | | ||||
48 | MouseArea { | ||||
49 | id: mouseArea | ||||
50 | property real startPoint: 0 | ||||
51 | anchors.fill: parent | ||||
52 | onPressed: { | ||||
53 | startPoint = mouse.x; | ||||
54 | } | ||||
55 | onPositionChanged: { | ||||
56 | window.adjustment -= (mouse.x - startPoint); | ||||
57 | window.adjustmentFactor = Math.min(Math.max(window.adjustment / window.width, 0.0), 0.66); | ||||
58 | startPoint = mouse.x; | ||||
59 | } | ||||
60 | } | ||||
61 | } | ||||
32 | } | 62 | } |