mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-17 19:20:46 +00:00
Show line cursor in overview
This commit is contained in:
parent
861dd5cfca
commit
b59efb0afb
@ -128,8 +128,9 @@ void gFlagsGroup::paint(QPainter &painter, gGraph &g, const QRegion ®ion)
|
|||||||
bool gFlagsGroup::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
bool gFlagsGroup::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (graph->graphView()->metaSelect())
|
if (p_profile->appearance->lineCursorMode()) {
|
||||||
graph->timedRedraw(30);
|
graph->timedRedraw(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!p_profile->appearance->graphTooltips()) {
|
if (!p_profile->appearance->graphTooltips()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -696,8 +696,8 @@ void gGraph::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
int x2 = m_graphview->pointClicked().x() - m_rect.left();
|
int x2 = m_graphview->pointClicked().x() - m_rect.left();
|
||||||
|
|
||||||
int w = m_rect.width() - (left + right);
|
int w = m_rect.width() - left - right;
|
||||||
//int h=m_lastbounds.height()-(bottom+m_marginbottom);
|
|
||||||
double xx = max_x - min_x;
|
double xx = max_x - min_x;
|
||||||
double xmult = xx / w;
|
double xmult = xx / w;
|
||||||
|
|
||||||
|
@ -1982,10 +1982,15 @@ void gGraphView::refreshTimeout()
|
|||||||
}
|
}
|
||||||
void gGraphView::timedRedraw(int ms)
|
void gGraphView::timedRedraw(int ms)
|
||||||
{
|
{
|
||||||
if (!timer->isActive()) {
|
|
||||||
timer->setSingleShot(true);
|
if (timer->isActive()) {
|
||||||
timer->start(ms);
|
int m = timer->remainingTime();
|
||||||
|
if (m > ms) {
|
||||||
|
timer->stop();
|
||||||
|
} else return;
|
||||||
}
|
}
|
||||||
|
timer->setSingleShot(true);
|
||||||
|
timer->start(ms);
|
||||||
}
|
}
|
||||||
void gGraphView::resetLayout()
|
void gGraphView::resetLayout()
|
||||||
{
|
{
|
||||||
|
@ -160,8 +160,7 @@ EventDataType gLineChart::Maxy()
|
|||||||
bool gLineChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
bool gLineChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
if (graph->graphView()->metaSelect())
|
Q_UNUSED(graph)
|
||||||
graph->timedRedraw(30);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +278,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
if ((time > minx) && (time < maxx)) {
|
if ((time > minx) && (time < maxx)) {
|
||||||
double xpos = (time - minx) * xmult;
|
double xpos = (time - minx) * xmult;
|
||||||
painter.setPen(QPen(QBrush(QColor(Qt::gray)),1));
|
painter.setPen(QPen(QBrush(QColor(0,255,0,255)),1));
|
||||||
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,6 +493,28 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
|
|
||||||
lastdaygood = true;
|
lastdaygood = true;
|
||||||
|
|
||||||
|
if (p_profile->appearance->lineCursorMode()) {
|
||||||
|
qint64 time = w.currentTime();
|
||||||
|
double xmult = double(width) / xx;
|
||||||
|
|
||||||
|
if ((time > minx) && (time < maxx)) {
|
||||||
|
double xpos = (time - minx) * xmult;
|
||||||
|
painter.setPen(QPen(QBrush(QColor(0,255,0,255)),1));
|
||||||
|
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QDateTime dt=QDateTime::fromMSecsSinceEpoch(time,Qt::UTC);
|
||||||
|
|
||||||
|
QString text = dt.date().toString(Qt::SystemLocaleLongDate);
|
||||||
|
|
||||||
|
int wid, h;
|
||||||
|
GetTextExtent(text, wid, h);
|
||||||
|
w.renderText(text, left + width/2 - wid/2, top-h+5);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numcodes; i++) {
|
for (int i = 0; i < numcodes; i++) {
|
||||||
totalcounts[i] = 0;
|
totalcounts[i] = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user