From 04e243682a7ebcd4c2a6dca7d16c8ad1257d15d5 Mon Sep 17 00:00:00 2001 From: Crylia Date: Mon, 24 Jun 2024 09:48:43 +0200 Subject: [PATCH] add first prototype of gridplanlayout --- src/View/PlanGrid/PlanGrid.cpp | 41 +++++++++++++++++++++++++++++++--- src/View/PlanGrid/PlanGrid.hpp | 12 ++++++++-- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/View/PlanGrid/PlanGrid.cpp b/src/View/PlanGrid/PlanGrid.cpp index 34566ff..fe975df 100644 --- a/src/View/PlanGrid/PlanGrid.cpp +++ b/src/View/PlanGrid/PlanGrid.cpp @@ -1,6 +1,41 @@ # include "PlanGrid.hpp" -PlanGrid::PlanGrid(QWidget* parent) -{ +PlanGrid::PlanGrid(QWidget* parent) : + QWidget(parent) { -} \ No newline at end of file + weekdays[0] = "Montag"; + weekdays[1] = "Dienstag"; + weekdays[2] = "Mittwoch"; + weekdays[3] = "Donnerstag"; + weekdays[4] = "Freitag"; + + times[0] = "8:00 - 9:00"; + times[1] = "9:00 - 10:00"; + times[2] = "10:00 - 11:00"; + times[3] = "11:00 - 12:00"; + times[4] = "12:00 - 13:00"; + times[5] = "13:00 - 14:00"; + times[6] = "14:00 - 15:00"; + times[7] = "15:00 - 16:00"; + times[8] = "16:00 - 17:00"; + times[9] = "17:00 - 18:00"; + + + planMap = new QMap, QLabel*>( ); + + for (int i = 0; i < 5; ++i) { + for (int j = 0; j < 10; ++j) { + planMap->insert(qMakePair(weekdays[i], times[j]), nullptr); + } + } + + for (int i = 1; i <= 5; i++) { + gridLayout->addWidget(new QLabel(weekdays[i]), 0, i); + } + for (int i = 0; i < 10; i++) { + gridLayout->addWidget(new QLabel(times[i]), i, 0); + } + + + setLayout(gridLayout); +} diff --git a/src/View/PlanGrid/PlanGrid.hpp b/src/View/PlanGrid/PlanGrid.hpp index 37a9820..e4a3b1b 100644 --- a/src/View/PlanGrid/PlanGrid.hpp +++ b/src/View/PlanGrid/PlanGrid.hpp @@ -1,9 +1,17 @@ # pragma once # include +# include +# include +# include -class PlanGrid { +class PlanGrid : public QWidget { + Q_OBJECT +private: + QString weekdays[5]; + QString times[10]; protected: QGridLayout* gridLayout; + QMap, QLabel*>* planMap; public: PlanGrid(QWidget* parent = nullptr); -}; \ No newline at end of file +};