From 0b7be46511ec752f1f28e73eac787da633c47f46 Mon Sep 17 00:00:00 2001 From: Louie S Date: Tue, 20 Feb 2024 17:28:22 -0500 Subject: Create group class --- src/assignmentList.cpp | 8 +++++--- src/assignmentList.h | 1 + src/group.cpp | 23 +++++++++++++++++++++++ src/group.h | 23 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/group.cpp create mode 100644 src/group.h (limited to 'src') diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp index 91c4716..d755da7 100644 --- a/src/assignmentList.cpp +++ b/src/assignmentList.cpp @@ -24,7 +24,6 @@ AssignmentList::AssignmentList() { // load uic ui.setupUi(this); - this->initializeUI(); } @@ -50,8 +49,8 @@ void AssignmentList::initializeUI() { // create toolbar ui.toolBar->addAction(ui.actionAdd_Group); - //Config() // from config.h this->setupDB(); + this->displayDate(); this->displayWidgets(); this->show(); } @@ -60,9 +59,12 @@ void AssignmentList::setupDB() { qDebug() << "WIP"; } -void AssignmentList::displayWidgets() { +void AssignmentList::displayDate() { QDate today = QDate::currentDate(); ui.title->setText(today.toString("dddd, MMM d yyyy")); +} + +void AssignmentList::displayWidgets() { //this->drawGroups(); } diff --git a/src/assignmentList.h b/src/assignmentList.h index 5df18e9..3e45351 100644 --- a/src/assignmentList.h +++ b/src/assignmentList.h @@ -20,6 +20,7 @@ class AssignmentList : public QMainWindow { void initializeSettings(); void initializeUI(); void setupDB(); + void displayDate(); void displayWidgets(); void editGroup(int id); void removeGroup(int id); diff --git a/src/group.cpp b/src/group.cpp new file mode 100644 index 0000000..7b8f63d --- /dev/null +++ b/src/group.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include "group.h" + +Group::Group(int id, QString name, QString column, QString link, bool hidden) { + this->id = id; + this->name = name; + this->column = column; + this->link = link; + this->hidden = hidden; + + this->setContentsMargins(0, 10, 0, 10); + + QLabel *name_label = new QLabel(this->name); + name_label->setTextInteractionFlags(Qt::TextSelectableByMouse); + + QFont name_font = QFont("Arial", 13); + name_font.setUnderline(true); + + name_label->setFont(name_font); + this->addWidget(name_label); +} diff --git a/src/group.h b/src/group.h new file mode 100644 index 0000000..b6899a9 --- /dev/null +++ b/src/group.h @@ -0,0 +1,23 @@ +#ifndef GROUP_H +#define GROUP_H + +#include +#include + +class Group : QVBoxLayout { + public: + int id; + QString name; + QString column; + QString link; + bool hidden; + + Group( int id, + QString name, + QString column = "left", + QString link = "", + bool hidden = false + ); +}; + +#endif -- cgit