From bdb594ada83058ae35edb5edf01703afa203e593 Mon Sep 17 00:00:00 2001 From: Louie S Date: Mon, 26 Feb 2024 17:04:26 -0500 Subject: Loading groups from db --- src/assignmentList.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/assignmentList.cpp') diff --git a/src/assignmentList.cpp b/src/assignmentList.cpp index 17ec3cc..0ccda0e 100644 --- a/src/assignmentList.cpp +++ b/src/assignmentList.cpp @@ -51,24 +51,38 @@ void AssignmentList::initializeUI() { // create toolbar ui.toolBar->addAction(ui.actionAdd_Group); - this->setupDB(); + // setup database + BackendDB::init(); + this->displayDate(); this->displayWidgets(); this->show(); } -void AssignmentList::setupDB() { - BackendDB::init(); - qDebug() << "WIP"; -} - void AssignmentList::displayDate() { QDate today = QDate::currentDate(); ui.title->setText(today.toString("dddd, MMM d yyyy")); } void AssignmentList::displayWidgets() { - //this->drawGroups(); + QVBoxLayout *column_left = new QVBoxLayout(); + QVBoxLayout *column_right = new QVBoxLayout(); + QList groups = BackendDB::loadGroups(); + int i; + + for(i = 0; i < groups.size(); ++i) { + if(groups[i]->hidden) continue; + // TODO set right click behavior + // TODO add entries to this layout + if(groups[i]->column.toLower() == "left") column_left->addLayout(groups[i]); + else column_right->addLayout(groups[i]); + } + + column_left->addStretch(); + column_right->addStretch(); + + ui.groups_layout->addLayout(column_left, 0, 0); + ui.groups_layout->addLayout(column_right, 0, 1); } // Open the 'addGroup' form -- cgit