Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
View
ViewProfileDivider.h
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3
* under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4
* LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5
******************************************************************************************************/
6
7
#ifndef VIEW_PROFILE_DIVIDER_H
8
#define VIEW_PROFILE_DIVIDER_H
9
10
#include <QGraphicsRectItem>
11
#include <QObject>
12
13
class
QGraphicsLineItem;
14
class
QGraphicsScene;
15
class
QGraphicsPolygonItem;
16
class
QGraphicsView;
17
23
class
ViewProfileDivider
:
public
QObject,
public
QGraphicsRectItem
24
{
25
Q_OBJECT;
26
27
public
:
29
ViewProfileDivider
(QGraphicsScene &scene,
30
QGraphicsView &view,
31
int
sceneWidth,
32
int
sceneHeight,
33
int
yCenter,
34
bool
isLowerBoundary);
35
37
virtual
QVariant
itemChange
(GraphicsItemChange change,
const
QVariant &value);
38
40
virtual
void
mousePressEvent
(QGraphicsSceneMouseEvent *event);
41
43
void
setX
(
double
x,
44
double
xLow,
45
double
xHigh);
46
47
private
slots:
49
void
slotOtherMoved(
double
xSceneOther);
50
51
signals:
53
void
signalMovedLow
(
double
xSceneOther);
54
56
void
signalMovedHigh
(
double
xSceneOther);
57
58
private
:
59
ViewProfileDivider
();
60
61
void
sendSignalMoved ();
62
63
// Update geoemtries since one of the dividers (this or the other) moved
64
void
updateGeometryDivider ();
65
void
updateGeometryNonPaddle ();
66
void
updateGeometryPaddle ();
67
68
QGraphicsView &m_view;
69
int
m_yCenter;
70
double
m_xScene;
// X coordinae of this divider
71
double
m_xSceneOther;
// X coordinate of other divider. Used when the two dividers have moved past each other so there
72
// are two unshaded areas
73
QGraphicsLineItem *m_divider;
74
QGraphicsRectItem *m_shadedArea;
75
QGraphicsPolygonItem *m_arrow;
76
int
m_sceneWidth;
77
int
m_sceneHeight;
78
bool
m_isLowerBoundary;
79
80
QPointF m_startDragPos;
81
};
82
83
#endif
// VIEW_PROFILE_DIVIDER_H
ViewProfileDivider::signalMovedHigh
void signalMovedHigh(double xSceneOther)
Signal used when divider is dragged and m_isLowerBoundary is false.
ViewProfileDivider::signalMovedLow
void signalMovedLow(double xSceneOther)
Signal used when divider is dragged and m_isLowerBoundary is true.
ViewProfileDivider::setX
void setX(double x, double xLow, double xHigh)
Set the position by specifying the new x coordinate.
Definition
ViewProfileDivider.cpp:128
ViewProfileDivider::ViewProfileDivider
ViewProfileDivider(QGraphicsScene &scene, QGraphicsView &view, int sceneWidth, int sceneHeight, int yCenter, bool isLowerBoundary)
Single constructor.
Definition
ViewProfileDivider.cpp:30
ViewProfileDivider::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Save paddle position at start of click-and-drag.
Definition
ViewProfileDivider.cpp:112
ViewProfileDivider::itemChange
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Intercept changes so divider movement can be restricted to horizontal direction only.
Definition
ViewProfileDivider.cpp:87
Generated on
for Engauge Digitizer by
1.17.0