Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Signals | Public Member Functions | List of all members
GraphicsPointEllipse Class Reference

This class add event handling to QGraphicsEllipseItem. More...

#include <GraphicsPointEllipse.h>

Inheritance diagram for GraphicsPointEllipse:
Inheritance graph
Collaboration diagram for GraphicsPointEllipse:
Collaboration graph

Signals

void signalPointHoverEnter (QString)
 Signal for geometry window to highlight the current point upon hover enter. More...
 
void signalPointHoverLeave (QString)
 Signal for geometry window to unhighlight the current point upon hover leave. More...
 

Public Member Functions

 GraphicsPointEllipse (GraphicsPoint &graphicsPoint, const QRect &rect)
 Single constructor. More...
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 Intercept moves by dragging so moved items can be identified. This replaces unreliable hit tests. More...
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 Accept hover so point can be highlighted when cursor is over it as a guide to user. More...
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 Unhighlight this point. More...
 
void setRadius (int radius)
 Update the radius. More...
 
void setShadow (GraphicsPointEllipse *shadow)
 Bind this graphics item to its shadow. More...
 

Detailed Description

This class add event handling to QGraphicsEllipseItem.

Definition at line 17 of file GraphicsPointEllipse.h.

Constructor & Destructor Documentation

GraphicsPointEllipse::GraphicsPointEllipse ( GraphicsPoint graphicsPoint,
const QRect &  rect 
)

Single constructor.

Definition at line 15 of file GraphicsPointEllipse.cpp.

16  :
17  QGraphicsEllipseItem (rect),
18  m_graphicsPoint (graphicsPoint),
19  m_shadow (nullptr)
20 {
21  LOG4CPP_INFO_S ((*mainCat)) << "GraphicsPointEllipse::GraphicsPointEllipse";
22 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

void GraphicsPointEllipse::hoverEnterEvent ( QGraphicsSceneHoverEvent *  event)
virtual

Accept hover so point can be highlighted when cursor is over it as a guide to user.

Definition at line 24 of file GraphicsPointEllipse.cpp.

25 {
26  // Highlighted
27  setOpacityForSubtree (m_graphicsPoint.highlightOpacity());
28 
29  emit signalPointHoverEnter (data (DATA_KEY_IDENTIFIER).toString ());
30 
31  QGraphicsEllipseItem::hoverEnterEvent (event);
32 }
void signalPointHoverEnter(QString)
Signal for geometry window to highlight the current point upon hover enter.
double highlightOpacity() const
Get method for highlight opacity.
void GraphicsPointEllipse::hoverLeaveEvent ( QGraphicsSceneHoverEvent *  event)
virtual

Unhighlight this point.

Definition at line 34 of file GraphicsPointEllipse.cpp.

35 {
36  // Unhighlighted
37  setOpacityForSubtree (MAX_OPACITY);
38 
39  emit signalPointHoverLeave (data (DATA_KEY_IDENTIFIER).toString ());
40 
41  QGraphicsEllipseItem::hoverLeaveEvent (event);
42 }
const double MAX_OPACITY
void signalPointHoverLeave(QString)
Signal for geometry window to unhighlight the current point upon hover leave.
QVariant GraphicsPointEllipse::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)

Intercept moves by dragging so moved items can be identified. This replaces unreliable hit tests.

Definition at line 44 of file GraphicsPointEllipse.cpp.

46 {
47  if (change == QGraphicsItem::ItemPositionHasChanged) {
48 
49  LOG4CPP_DEBUG_S ((*mainCat)) << "GraphicsPointEllipse::itemChange"
50  << " identifier=" << data (DATA_KEY_IDENTIFIER).toString().toLatin1().data()
51  << " positionHasChanged";
52 
53  setData (DATA_KEY_POSITION_HAS_CHANGED, QVariant (true));
54  }
55 
56  return QGraphicsEllipseItem::itemChange(change,
57  value);
58 }
Item type (i.e. image versus point)
Definition: DataKey.h:16
log4cpp::Category * mainCat
Definition: Logger.cpp:14
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20
void GraphicsPointEllipse::setRadius ( int  radius)

Update the radius.

Definition at line 72 of file GraphicsPointEllipse.cpp.

73 {
74  // Resize assuming symmetry about the origin, and an aspect ratio of 1:1 (so x and y scales are the same)
75  if (boundingRect().width() > 0) {
76  double scale = (2 * radius) / boundingRect().width();
77  setScale (scale);
78  }
79 }
void GraphicsPointEllipse::setShadow ( GraphicsPointEllipse shadow)

Bind this graphics item to its shadow.

Definition at line 81 of file GraphicsPointEllipse.cpp.

82 {
83  m_shadow = shadow;
84 }
void GraphicsPointEllipse::signalPointHoverEnter ( QString  )
signal

Signal for geometry window to highlight the current point upon hover enter.

void GraphicsPointEllipse::signalPointHoverLeave ( QString  )
signal

Signal for geometry window to unhighlight the current point upon hover leave.


The documentation for this class was generated from the following files: