diff options
-rw-r--r-- | CMakeLists.txt | 22 | ||||
-rw-r--r-- | src/frontend/qtquick/main.cpp | 25 | ||||
-rw-r--r-- | src/frontend/qtquick/main.qml | 25 | ||||
-rw-r--r-- | src/frontend/qtquick/qml.qrc | 5 |
4 files changed, 76 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a0d70d3..18fa2f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ if(IS_RELEASE) set(NSIS_PRODUCT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.0.0") endif() -set(qt_components "Core" "Gui" "Sql" "UiTools" "Widgets") +set(qt_components "Core" "Gui" "Sql" "UiTools" "Widgets" "Quick") set(qt_names "Qt6" "Qt5") if(USE_QT5) set(qt_names "Qt5") @@ -58,6 +58,7 @@ foreach(X ${qt_components}) list(APPEND qt_libraries "Qt${QT_VERSION_MAJOR}::${X}") endforeach() +# QtWidgets sources set(project_sources_frontend "src/frontend/qtwidgets/addEntryForm.cpp" "src/frontend/qtwidgets/addGroupForm.cpp" @@ -131,6 +132,12 @@ set(project_sources_full ${project_misc} ) +# Sources unique to qtquick +set(qtquick_sources + "src/frontend/qtquick/main.cpp" + "src/frontend/qtquick/qml.qrc" +) + configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) if(CMAKE_SYSTEM MATCHES "Windows*") configure_file(nsis/installer.nsi.in ${CMAKE_CURRENT_BINARY_DIR}/installer.nsi @ONLY) @@ -145,6 +152,10 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) MANUAL_FINALIZATION ${project_sources_full} ) + qt_add_executable(assignment-list-mobile + MANUAL_FINALIZATION + ${qtquick_sources} + ) # Define target properties for Android with Qt 6 as: # set_property(TARGET qt_quick_hello APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) @@ -154,19 +165,27 @@ else() add_library(assignment-list SHARED ${project_sources_full} ) + add_library(assignment-list-mobile SHARED + ${qtquick_sources} + ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") else() add_executable(assignment-list ${project_sources_full} ) + add_executable(assignment-list-mobile + ${qtquick_sources} + ) endif() endif() # Avoid opening console on windows set_target_properties(assignment-list PROPERTIES WIN32_EXECUTABLE ON) +set_target_properties(assignment-list-mobile PROPERTIES WIN32_EXECUTABLE ON) target_link_libraries(assignment-list PUBLIC ${qt_libraries}) +target_link_libraries(assignment-list-mobile PUBLIC ${qt_libraries}) # Installation include(GNUInstallDirs) @@ -185,6 +204,7 @@ endif() if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(assignment-list) + qt_finalize_executable(assignment-list-mobile) endif() # CPack configuration diff --git a/src/frontend/qtquick/main.cpp b/src/frontend/qtquick/main.cpp new file mode 100644 index 0000000..c2c84fc --- /dev/null +++ b/src/frontend/qtquick/main.cpp @@ -0,0 +1,25 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreated, + &app, + [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, + Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/src/frontend/qtquick/main.qml b/src/frontend/qtquick/main.qml new file mode 100644 index 0000000..18936fd --- /dev/null +++ b/src/frontend/qtquick/main.qml @@ -0,0 +1,25 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Window 2.15 + +Window { + width: 640 + height: 480 + visible: true + // TODO grab this from config.h + title: qsTr("Assignment List") + + // DropDown for groups (including an "all" option) + Item { + width: parent.width + height: 50 + ComboBox { + anchors.fill: parent + id: groupComboBox + model: [ + "all" + //... + ] + } + } +} diff --git a/src/frontend/qtquick/qml.qrc b/src/frontend/qtquick/qml.qrc new file mode 100644 index 0000000..5f6483a --- /dev/null +++ b/src/frontend/qtquick/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + </qresource> +</RCC> |