summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--EventInfoPage.qml27
-rw-r--r--EventsPage.qml37
-rw-r--r--application.qml16
-rw-r--r--application.qrc6
-rw-r--r--qtquickcontrols2.conf12
6 files changed, 93 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e683225..8b82d00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,9 +3,9 @@ project(itat_challange_olympics)
set(CMAKE_CXX_STANDARD 17)
-add_executable(itat_challange_olympics main.cpp)
-
find_package(Qt6 REQUIRED COMPONENTS Core)
+set(CMAKE_AUTORCC ON)
+qt_add_executable(itat_challange_olympics application.qrc main.cpp)
target_link_libraries(itat_challange_olympics PRIVATE Qt6::Core)
find_package(Qt6 REQUIRED COMPONENTS Quick)
diff --git a/EventInfoPage.qml b/EventInfoPage.qml
new file mode 100644
index 0000000..956507e
--- /dev/null
+++ b/EventInfoPage.qml
@@ -0,0 +1,27 @@
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Controls
+
+Page {
+ id: root
+ property string event_id
+
+ header: ToolBar {
+ ToolButton {
+ text: qsTr("Back")
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.verticalCenter: parent.verticalCenter
+ onClicked: root.StackView.view.pop()
+ }
+ Label {
+ id: pageTitle
+ font.pixelSize: 20
+ anchors.centerIn: parent
+ text: qsTr("Event Info")
+ }
+ }
+
+
+}
+
diff --git a/EventsPage.qml b/EventsPage.qml
new file mode 100644
index 0000000..772418e
--- /dev/null
+++ b/EventsPage.qml
@@ -0,0 +1,37 @@
+import QtQuick
+import QtQuick.Controls
+
+Page {
+ id: root
+ header: ToolBar {
+ Label {
+ text: qsTr("Olympia 2024 Events")
+ font.pixelSize: 20
+ anchors.centerIn: parent
+ }
+ }
+
+ ListView {
+ id: listView
+ anchors.fill: parent
+ topMargin: 48
+ leftMargin: 48
+ bottomMargin: 48
+ rightMargin: 48
+ spacing: 20
+ model: ["Albert Einstein", "Ernest Hemingway", "Hans Gude"]
+ delegate: ItemDelegate {
+ text: modelData
+ width: listView.width - listView.leftMargin - listView.rightMargin
+ height: avatar.implicitHeight + 32
+ leftPadding: avatar.implicitWidth + 32
+ onClicked: root.StackView.view.push("EventInfoPage.qml", { event_id: 1 })
+
+ Image {
+ id: avatar
+ // source: "images/" + modelData.replace(" ", "_") + ".png"
+ }
+ }
+ }
+}
+
diff --git a/application.qml b/application.qml
index 38da5d6..cf7b04d 100644
--- a/application.qml
+++ b/application.qml
@@ -2,12 +2,14 @@ import QtQuick
import QtQuick.Controls
ApplicationWindow {
- width: 400
- height: 400
- visible: true
+ width: 400
+ height: 400
+ visible: true
- Button {
- id: button
- text: "A Special Button"
- }
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ initialItem: EventsPage {}
+ }
}
+
diff --git a/application.qrc b/application.qrc
new file mode 100644
index 0000000..cadae14
--- /dev/null
+++ b/application.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>qtquickcontrols2.conf</file>
+</qresource>
+</RCC>
+
diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf
new file mode 100644
index 0000000..9dec440
--- /dev/null
+++ b/qtquickcontrols2.conf
@@ -0,0 +1,12 @@
+[Controls]
+Style=Material
+
+[Universal]
+Theme=Material
+Accent=Red
+
+[Material]
+Theme=Light
+Accent=Teal
+Primary=BlueGrey
+