Engauge Digitizer 2
Loading...
Searching...
No Matches
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.
 
void signalPointHoverLeave (QString)
 Signal for geometry window to unhighlight the current point upon hover leave.
 

Public Member Functions

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

Detailed Description

This class add event handling to QGraphicsEllipseItem.

Definition at line 17 of file GraphicsPointEllipse.h.

Constructor & Destructor Documentation

◆ GraphicsPointEllipse()

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}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

Member Function Documentation

◆ hoverEnterEvent()

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
30
31 QGraphicsEllipseItem::hoverEnterEvent (event);
32}
@ DATA_KEY_IDENTIFIER
Definition DataKey.h:14
void signalPointHoverEnter(QString)
Signal for geometry window to highlight the current point upon hover enter.
double highlightOpacity() const
Get method for highlight opacity.

◆ hoverLeaveEvent()

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
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.

◆ itemChange()

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
54 }
55
56 return QGraphicsEllipseItem::itemChange(change,
57 value);
58}
@ DATA_KEY_POSITION_HAS_CHANGED
‍Item type (i.e. image versus point)
Definition DataKey.h:16
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20

◆ setRadius()

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();
78 }
79}

◆ setShadow()

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}

◆ signalPointHoverEnter

void GraphicsPointEllipse::signalPointHoverEnter ( QString )
signal

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

◆ signalPointHoverLeave

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: