From a88e98f23e4f796e34fdb862ab57f21fdb679874 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 12 Feb 2024 07:31:29 -0800 Subject: [PATCH] initial qml showing on device from IDE over SSH: --- .gitignore | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 41 ++++++++++++++++++++++++++++ Main.qml | 43 +++++++++++++++++++++++++++++ main.cpp | 21 ++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Main.qml create mode 100644 main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1854270 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.16) + +project(testqtonrpi VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt6 6.4 REQUIRED COMPONENTS Quick) + +qt_standard_project_setup() + +qt_add_executable(apptestqtonrpi + main.cpp +) + +qt_add_qml_module(apptestqtonrpi + URI testqtonrpi + VERSION 1.0 + QML_FILES Main.qml +) + +# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. +# If you are developing for iOS or macOS you should consider setting an +# explicit, fixed bundle identifier manually though. +set_target_properties(apptestqtonrpi PROPERTIES +# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.apptestqtonrpi + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +target_link_libraries(apptestqtonrpi + PRIVATE Qt6::Quick +) + +include(GNUInstallDirs) +install(TARGETS apptestqtonrpi + BUNDLE DESTINATION . + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/Main.qml b/Main.qml new file mode 100644 index 0000000..e10783c --- /dev/null +++ b/Main.qml @@ -0,0 +1,43 @@ +import QtQuick +import QtQuick.VirtualKeyboard + +Window { + id: window + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + Text { + text: "Yo yo what's up" + } + + InputPanel { + id: inputPanel + z: 99 + x: 0 + y: window.height + width: window.width + + states: State { + name: "visible" + when: inputPanel.active + PropertyChanges { + target: inputPanel + y: window.height - inputPanel.height + } + } + transitions: Transition { + from: "" + to: "visible" + reversible: true + ParallelAnimation { + NumberAnimation { + properties: "y" + duration: 250 + easing.type: Easing.InOutQuad + } + } + } + } +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..43b814b --- /dev/null +++ b/main.cpp @@ -0,0 +1,21 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(u"qrc:/testqtonrpi/Main.qml"_qs); + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreationFailed, + &app, + []() { QCoreApplication::exit(-1); }, + Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +}