1 // Copyright (c) 2016 The SigViewer Development Team 2 // Licensed under the GNU General Public License (GPL) 3 // https://www.gnu.org/licenses/gpl 4 5 6 #ifndef EVENT_CONTEXT_MENU_H 7 #define EVENT_CONTEXT_MENU_H 8 9 #include "event_graphics_item.h" 10 #include "file_handling/event_manager.h" 11 #include "gui/signal_visualisation_model.h" 12 13 #include <QVector> 14 #include <QSharedPointer> 15 #include <QMenu> 16 #include <QObject> 17 #include <QIcon> 18 19 namespace sigviewer 20 { 21 22 //----------------------------------------------------------------------------- 23 /// 24 /// EventContextMenu 25 /// 26 /// enables editing of events... allows selection of events 27 28 29 class EventContextMenu : public QMenu 30 { 31 Q_OBJECT 32 33 public: 34 //------------------------------------------------------------------------- 35 EventContextMenu (SignalVisualisationModel& browser_model, 36 QSharedPointer<EventManager> event_manager); 37 38 //------------------------------------------------------------------------- 39 virtual ~EventContextMenu (); 40 41 //------------------------------------------------------------------------- 42 void addEvent (EventID event); 43 44 //------------------------------------------------------------------------- 45 unsigned getNumberOfEvents () const; 46 47 //------------------------------------------------------------------------- 48 void finaliseAndShowContextMenu (QGraphicsSceneContextMenuEvent* context_event, 49 QMenu* channel_menu = 0); 50 51 //------------------------------------------------------------------------- 52 void finaliseAndShowSelectionMenu (QGraphicsSceneMouseEvent* context_event); 53 54 55 private: 56 //------------------------------------------------------------------------- 57 void addActionsToMenu (QMenu& menu, EventID event); 58 59 QVector<EventID> event_ids_; 60 QVector<QMenu*> sub_menus_; 61 SignalVisualisationModel& browser_model_; 62 QSharedPointer<EventManager> event_manager_; 63 64 //------------------------------------------------------------------------- 65 /// copy-constructor disabled 66 EventContextMenu (EventContextMenu const &); 67 68 //------------------------------------------------------------------------- 69 /// assignment-operator disabled 70 EventContextMenu& operator= (EventContextMenu const &); 71 72 //signals: 73 // void hovered (QAction* q); 74 public slots: 75 void selectEvent (QAction* q); 76 77 }; 78 79 } 80 81 #endif // EVENT_CONTEXT_MENU_H 82