mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 20:20:44 +00:00
Show context based information in above graph text while alt is pressed. Clean up location of mouse time calculation
This commit is contained in:
parent
901889c496
commit
93dc4722b5
@ -671,6 +671,11 @@ void gGraph::timedRedraw(int ms)
|
|||||||
m_graphview->timedRedraw(ms);
|
m_graphview->timedRedraw(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 gGraph::currentTime() const
|
||||||
|
{
|
||||||
|
return m_graphview->currentTime();
|
||||||
|
}
|
||||||
|
|
||||||
void gGraph::mouseMoveEvent(QMouseEvent *event)
|
void gGraph::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// qDebug() << m_title << "Move" << event->pos() << m_graphview->pointClicked();
|
// qDebug() << m_title << "Move" << event->pos() << m_graphview->pointClicked();
|
||||||
@ -696,6 +701,21 @@ void gGraph::mouseMoveEvent(QMouseEvent *event)
|
|||||||
double xx = max_x - min_x;
|
double xx = max_x - min_x;
|
||||||
double xmult = xx / w;
|
double xmult = xx / w;
|
||||||
|
|
||||||
|
{
|
||||||
|
xmult = (m_blockzoom ? (rmax_x - rmin_x) : (max_x - min_x)) / w;
|
||||||
|
|
||||||
|
double a = x;
|
||||||
|
|
||||||
|
if (a < left) a = left;
|
||||||
|
if (a > left+w) a = left+w;
|
||||||
|
|
||||||
|
a -= left;
|
||||||
|
a *= xmult;
|
||||||
|
a += m_blockzoom ? rmin_x : min_x;
|
||||||
|
|
||||||
|
m_graphview->setCurrentTime(a);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_graphview->m_selected_graph == this) { // Left Mouse button dragging
|
if (m_graphview->m_selected_graph == this) { // Left Mouse button dragging
|
||||||
if (event->buttons() & Qt::LeftButton) {
|
if (event->buttons() & Qt::LeftButton) {
|
||||||
|
|
||||||
|
@ -104,6 +104,9 @@ class gGraph : public QObject
|
|||||||
//! \brief Returns true if none of the included layers have data attached
|
//! \brief Returns true if none of the included layers have data attached
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
|
|
||||||
|
qint64 currentTime() const;
|
||||||
|
|
||||||
|
|
||||||
//! \brief Add Layer l to graph object, allowing you to specify position,
|
//! \brief Add Layer l to graph object, allowing you to specify position,
|
||||||
// margin sizes, order, movability status and offsets
|
// margin sizes, order, movability status and offsets
|
||||||
void AddLayer(Layer *l, LayerPosition position = LayerCenter,
|
void AddLayer(Layer *l, LayerPosition position = LayerCenter,
|
||||||
|
@ -374,6 +374,11 @@ class gGraphView
|
|||||||
//! \brief Used internally by graph mousehandler to set modifier state
|
//! \brief Used internally by graph mousehandler to set modifier state
|
||||||
void setMetaSelect(bool b) { m_metaselect = b; }
|
void setMetaSelect(bool b) { m_metaselect = b; }
|
||||||
|
|
||||||
|
//! \brief The current time the mouse pointer is hovering over
|
||||||
|
inline qint64 currentTime() { return m_currenttime; }
|
||||||
|
|
||||||
|
inline void setCurrentTime(qint64 time) { m_currenttime = time; }
|
||||||
|
|
||||||
inline QPoint currentMousePos() const { return m_mouse; }
|
inline QPoint currentMousePos() const { return m_mouse; }
|
||||||
|
|
||||||
// for profiling purposes, a count of lines drawn in a single frame
|
// for profiling purposes, a count of lines drawn in a single frame
|
||||||
@ -489,6 +494,8 @@ class gGraphView
|
|||||||
bool m_blockUpdates;
|
bool m_blockUpdates;
|
||||||
|
|
||||||
QPoint m_mouse;
|
QPoint m_mouse;
|
||||||
|
qint64 m_currenttime;
|
||||||
|
|
||||||
|
|
||||||
QTime m_animationStarted;
|
QTime m_animationStarted;
|
||||||
|
|
||||||
|
@ -275,25 +275,21 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (w.graphView()->metaSelect()) {
|
if (w.graphView()->metaSelect()) {
|
||||||
|
qint64 time = w.currentTime();
|
||||||
|
|
||||||
|
if ((time > minx) && (time < maxx)) {
|
||||||
QPoint mouse = w.graphView()->currentMousePos();
|
double xpos = (time - minx) * xmult;
|
||||||
double pos = mouse.x() - left;
|
|
||||||
if (pos > 0) {
|
|
||||||
qint64 xpos = minx + (pos * (xx / double(width)));
|
|
||||||
|
|
||||||
painter.setPen(QPen(QBrush(QColor(Qt::gray)),1));
|
painter.setPen(QPen(QBrush(QColor(Qt::gray)),1));
|
||||||
painter.drawLine(mouse.x(), top-w.marginTop()-3, mouse.x(), top+height+w.bottom-1);
|
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
||||||
|
|
||||||
|
|
||||||
QString text = getMetaString(CPAP_Pressure, xpos);
|
|
||||||
|
|
||||||
int wid, h;
|
|
||||||
GetTextExtent(text, wid, h);
|
|
||||||
w.renderText(text, left + width/2 - wid/2, top-h+5);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString text = getMetaString(m_codes[0], time);
|
||||||
|
|
||||||
|
int wid, h;
|
||||||
|
GetTextExtent(text, wid, h);
|
||||||
|
w.renderText(text, left + width/2 - wid/2, top-h+5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventDataType lastpx, lastpy;
|
EventDataType lastpx, lastpy;
|
||||||
|
Loading…
Reference in New Issue
Block a user