mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
add a quick touch test panel
This commit is contained in:
parent
5ac357c0e9
commit
a9ab4a0c01
7 changed files with 106 additions and 0 deletions
|
|
@ -56,3 +56,4 @@ add_subdirectory(applets)
|
||||||
add_subdirectory(containments)
|
add_subdirectory(containments)
|
||||||
add_subdirectory(dialer)
|
add_subdirectory(dialer)
|
||||||
add_subdirectory(sounds)
|
add_subdirectory(sounds)
|
||||||
|
add_subdirectory(touchscreentest)
|
||||||
|
|
|
||||||
19
touchscreentest/CMakeLists.txt
Normal file
19
touchscreentest/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(touchtest LANGUAGES CXX)
|
||||||
|
|
||||||
|
|
||||||
|
SET(touchtest_SRC
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
QT5_ADD_RESOURCES(touchtest_SRC
|
||||||
|
qml.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(touchtest ${touchtest_SRC})
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick Qt5::Widgets)
|
||||||
|
|
||||||
|
INSTALL( TARGETS touchtest DESTINATION bin)
|
||||||
|
INSTALL( PROGRAMS org.kde.touchtest.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
|
||||||
15
touchscreentest/main.cpp
Normal file
15
touchscreentest/main.cpp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
|
||||||
|
if (engine.rootObjects().isEmpty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
30
touchscreentest/main.qml
Normal file
30
touchscreentest/main.qml
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.0
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
visible: true
|
||||||
|
width: 640
|
||||||
|
height: 480
|
||||||
|
title: qsTr("Hello World")
|
||||||
|
|
||||||
|
function format(text, mouse) {
|
||||||
|
return text + " " + Math.round(mouse.x*100)/100 + " " + Math.round(mouse.y*100)/100
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onPressed: label.text = format("MOUSE PRESS", mouse)
|
||||||
|
onPositionChanged: label.text = format("MOUSE Position change", mouse)
|
||||||
|
onReleased: label.text = label.text = format("MOUSE Release", mouse)
|
||||||
|
onCanceled: label.text = label.text = format("MOUSE Cancel", mouse)
|
||||||
|
Label {
|
||||||
|
id: label
|
||||||
|
anchors.fill:parent
|
||||||
|
font.pointSize: 20
|
||||||
|
verticalAlignment: Text.AlignHCenter
|
||||||
|
horizontalAlignment: Text.AlignVCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
touchscreentest/org.kde.touchtest.desktop
Executable file
21
touchscreentest/org.kde.touchtest.desktop
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Touch Test
|
||||||
|
|
||||||
|
Categories=Qt;KDE;System;Development;
|
||||||
|
|
||||||
|
Exec=touchtest
|
||||||
|
GenericName=Terminal
|
||||||
|
Icon=input-touchpad
|
||||||
|
MimeType=
|
||||||
|
|
||||||
|
Path=
|
||||||
|
StartupNotify=true
|
||||||
|
Terminal=false
|
||||||
|
TerminalOptions=
|
||||||
|
TryExec=touchtest
|
||||||
|
Type=Application
|
||||||
|
X-DBUS-ServiceName=
|
||||||
|
X-DBUS-StartupType=
|
||||||
|
X-KDE-AuthorizeAction=shell_access
|
||||||
|
X-KDE-SubstituteUID=false
|
||||||
|
X-KDE-Username=
|
||||||
5
touchscreentest/qml.qrc
Normal file
5
touchscreentest/qml.qrc
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>main.qml</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
15
touchscreentest/qtquickcontrols2.conf
Normal file
15
touchscreentest/qtquickcontrols2.conf
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
; This file can be edited to change the style of the application
|
||||||
|
; See Styling Qt Quick Controls 2 in the documentation for details:
|
||||||
|
; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
|
||||||
|
|
||||||
|
[Controls]
|
||||||
|
Style=Default
|
||||||
|
|
||||||
|
[Universal]
|
||||||
|
Theme=Light
|
||||||
|
;Accent=Steel
|
||||||
|
|
||||||
|
[Material]
|
||||||
|
Theme=Light
|
||||||
|
;Accent=BlueGrey
|
||||||
|
;Primary=BlueGray
|
||||||
Loading…
Reference in a new issue