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/group.cpp | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) (limited to 'src/group.cpp') diff --git a/src/group.cpp b/src/group.cpp index 1757753..d1c257f 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -1,12 +1,4 @@ -#include -#include -#include - -#include - -#include "add_entry_form.h" #include "group.h" -#include "lib.h" Group::Group(int id, QString name, QString column, QString link, bool hidden) : id(id), @@ -15,52 +7,4 @@ Group::Group(int id, QString name, QString column, QString link, bool hidden) : link(link), hidden(hidden) { - this->setContentsMargins(0, 10, 0, 10); - - QLabel *name_label = new QLabel(this->name); - name_label->setTextInteractionFlags(Qt::TextSelectableByMouse); - name_label->setToolTip("Right-Click for actions"); - name_label->setContextMenuPolicy(Qt::CustomContextMenu); - //name_label->customContextMenuRequested(const QPoint &pos) - QObject::connect(name_label, - SIGNAL(customContextMenuRequested(const QPoint &)), - SLOT(showContextMenu())); - - QFont name_font = QFont("Arial", 13); - name_font.setUnderline(true); - name_label->setFont(name_font); - - this->addWidget(name_label); -} - -void Group::showContextMenu() { - QMenu menu; - - QAction *add_entry_act = new QAction("Add Entry"); - QObject::connect(add_entry_act, &QAction::triggered, this, &Group::addEntry); - menu.addAction(add_entry_act); - - QAction *edit_group_act = new QAction("Edit Group"); - QObject::connect(edit_group_act, &QAction::triggered, this, &Group::editGroup); - menu.addAction(edit_group_act); - - QAction *del_group_act = new QAction("Remove Group"); - QObject::connect(del_group_act, &QAction::triggered, this, &Group::removeGroup); - menu.addAction(del_group_act); - - menu.exec(QCursor::pos()); -} - -void Group::addEntry() { - AddEntryForm create_new_entry_dialog(this->id); - if(create_new_entry_dialog.exec() == QDialog::Accepted) - getMainWindow()->displayWidgets(); -} - -void Group::editGroup() { - qDebug() << "WIP"; -} - -void Group::removeGroup() { - qDebug() << "WIP"; } -- cgit