summaryrefslogtreecommitdiff
path: root/src/group.cpp
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2024-03-01 18:22:59 -0500
committerLouie S <louie@example.com>2024-03-01 18:22:59 -0500
commit74c9ba962ffe142b04f77fd831438a75eec7b46b (patch)
tree3e59b5cd84d452a6580dec125fcb441d2d251945 /src/group.cpp
parent4b99428a0e73c9e573624b2784464ce8ae632e33 (diff)
Add right-click skeletons to groups
Diffstat (limited to 'src/group.cpp')
-rw-r--r--src/group.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/group.cpp b/src/group.cpp
index 781fb98..5bc6b7c 100644
--- a/src/group.cpp
+++ b/src/group.cpp
@@ -1,6 +1,9 @@
#include <QLabel>
+#include <QMenu>
#include <QString>
+#include <QDebug>
+
#include "group.h"
Group::Group(int id, QString name, QString column, QString link, bool hidden) :
@@ -14,10 +17,46 @@ Group::Group(int id, QString name, QString column, QString link, bool hidden) :
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() {
+ qDebug() << "WIP";
+}
+
+void Group::editGroup() {
+ qDebug() << "WIP";
+}
+
+void Group::removeGroup() {
+ qDebug() << "WIP";
+}