graph_analysis
Label.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_GUI_ITEMS_LABEL_HPP
2 #define GRAPH_ANALYSIS_GUI_ITEMS_LABEL_HPP
3 
4 #include <QGraphicsSceneDragDropEvent>
5 #include <QGraphicsTextItem>
6 #include <QTextCursor>
7 #include <QMouseEvent>
8 #include <QMimeData>
9 #include <QDrag>
10 
11 #include "../../Vertex.hpp"
12 #include <iostream>
13 
14 namespace graph_analysis {
15 namespace gui {
16 
17 class GraphWidget;
18 
19 namespace items {
20 
27 class Label : public QGraphicsTextItem
28 {
29 private:
30  // internal for deciding whether the mouse move event path is long enough to initiate a drag move
31  QPointF mDragStartPosition;
32 public:
38  Label(const std::string& label, QGraphicsItem* parent);
44  void setTextInteraction(bool on, bool selectAll = false);
45 protected:
47  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
49  QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value);
50 };
51 
52 } // end namespace items
53 } // end namespace gui
54 } // end namespace graph_analysis
55 #endif // GRAPH_ANALYSIS_GUI_ITEMS_LABEL_HPP
graph_analysis::gui::items::Label::mouseDoubleClickEvent
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
qt mouse double-click callback
Definition: Label.cpp:49
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::gui::items::Label
graphical node text label and Cluster label implementation
Definition: Label.hpp:27
graph_analysis::gui::items::Label::Label
Label(const std::string &label, QGraphicsItem *parent)
constructor
Definition: Label.cpp:14
graph_analysis::gui::items::Label::itemChange
QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
qt item changed callback
Definition: Label.cpp:61
graph_analysis::gui::items::Label::setTextInteraction
void setTextInteraction(bool on, bool selectAll=false)
toggles direct editing options of the displayed text
Definition: Label.cpp:25