Merge pull request #1 from Crylia/plangrid

add first prototype of gridplanlayout
This commit is contained in:
KaiokenKiller
2024-06-24 09:50:41 +02:00
committed by GitHub
2 changed files with 48 additions and 5 deletions

View File

@@ -1,6 +1,41 @@
# include "PlanGrid.hpp" # include "PlanGrid.hpp"
PlanGrid::PlanGrid(QWidget* parent) PlanGrid::PlanGrid(QWidget* parent) :
{ QWidget(parent) {
} 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<QPair<QString, QString>, 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);
}

View File

@@ -1,9 +1,17 @@
# pragma once # pragma once
# include <QGridLayout> # include <QGridLayout>
# include <QWidget>
# include <QLabel>
# include <QDateTime>
class PlanGrid { class PlanGrid : public QWidget {
Q_OBJECT
private:
QString weekdays[5];
QString times[10];
protected: protected:
QGridLayout* gridLayout; QGridLayout* gridLayout;
QMap<QPair<QString, QString>, QLabel*>* planMap;
public: public:
PlanGrid(QWidget* parent = nullptr); PlanGrid(QWidget* parent = nullptr);
}; };