diff --git a/CMakeLists.txt b/CMakeLists.txt index 17d0701a..52066bfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,3 +56,4 @@ add_subdirectory(applets) add_subdirectory(containments) add_subdirectory(dialer) add_subdirectory(sounds) +add_subdirectory(touchscreentest) diff --git a/touchscreentest/CMakeLists.txt b/touchscreentest/CMakeLists.txt new file mode 100644 index 00000000..a26442a9 --- /dev/null +++ b/touchscreentest/CMakeLists.txt @@ -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} ) diff --git a/touchscreentest/main.cpp b/touchscreentest/main.cpp new file mode 100644 index 00000000..404092c5 --- /dev/null +++ b/touchscreentest/main.cpp @@ -0,0 +1,15 @@ +#include +#include + +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(); +} diff --git a/touchscreentest/main.qml b/touchscreentest/main.qml new file mode 100644 index 00000000..c2cdb4aa --- /dev/null +++ b/touchscreentest/main.qml @@ -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 + } + } +} diff --git a/touchscreentest/org.kde.touchtest.desktop b/touchscreentest/org.kde.touchtest.desktop new file mode 100755 index 00000000..cfc75891 --- /dev/null +++ b/touchscreentest/org.kde.touchtest.desktop @@ -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= diff --git a/touchscreentest/qml.qrc b/touchscreentest/qml.qrc new file mode 100644 index 00000000..5f6483ac --- /dev/null +++ b/touchscreentest/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + diff --git a/touchscreentest/qtquickcontrols2.conf b/touchscreentest/qtquickcontrols2.conf new file mode 100644 index 00000000..1764b16f --- /dev/null +++ b/touchscreentest/qtquickcontrols2.conf @@ -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