From afcae23cbf63b31a7ce111ffcd76c027b332bdf9 Mon Sep 17 00:00:00 2001 From: Louie S Date: Sat, 9 Mar 2024 16:53:38 -0500 Subject: Break entry/group/rule into sub-classes --- src/ruleLayout.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/ruleLayout.cpp (limited to 'src/ruleLayout.cpp') diff --git a/src/ruleLayout.cpp b/src/ruleLayout.cpp new file mode 100644 index 0000000..f922f1a --- /dev/null +++ b/src/ruleLayout.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +#include "ruleLayout.h" + +RuleLayout::RuleLayout(const Rule &r) : + rule(r) +{ + QComboBox *when_widget = new QComboBox; + QDateTimeEdit *date_widget = new QDateTimeEdit(QDate::currentDate()); + QLineEdit *color_widget = new QLineEdit; // TODO consider making this a color selector widget + QLineEdit *highlight_widget = new QLineEdit; // TODO consider making this a color selector widget + + QStringList when_options; + when_options.append("Before"); + when_options.append("After"); + when_widget->addItems(when_options); + when_widget->setCurrentIndex(this->rule.when); + this->addWidget(when_widget); + + date_widget->setDisplayFormat("MM/dd/yyyy"); + date_widget->setDateTime(this->rule.date); + this->addWidget(date_widget); + + this->addStretch(); + + color_widget->setPlaceholderText("Color"); + if(!this->rule.color.isEmpty()) + color_widget->setText(this->rule.color); + this->addWidget(color_widget); + + highlight_widget->setPlaceholderText("Highlight"); + if(!this->rule.highlight.isEmpty()) + highlight_widget->setText(this->rule.highlight); + this->addWidget(highlight_widget); +} -- cgit