mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 12:40:43 +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)
|
||||
{
|
||||
|
||||
if (graph->graphView()->metaSelect())
|
||||
graph->timedRedraw(30);
|
||||
if (p_profile->appearance->lineCursorMode()) {
|
||||
graph->timedRedraw(0);
|
||||
}
|
||||
|
||||
if (!p_profile->appearance->graphTooltips()) {
|
||||
return false;
|
||||
|
@ -696,8 +696,8 @@ void gGraph::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
int x2 = m_graphview->pointClicked().x() - m_rect.left();
|
||||
|
||||
int w = m_rect.width() - (left + right);
|
||||
//int h=m_lastbounds.height()-(bottom+m_marginbottom);
|
||||
int w = m_rect.width() - left - right;
|
||||
|
||||
double xx = max_x - min_x;
|
||||
double xmult = xx / w;
|
||||
|
||||
|
@ -1982,10 +1982,15 @@ void gGraphView::refreshTimeout()
|
||||
}
|
||||
void gGraphView::timedRedraw(int ms)
|
||||
{
|
||||
if (!timer->isActive()) {
|
||||
timer->setSingleShot(true);
|
||||
timer->start(ms);
|
||||
|
||||
if (timer->isActive()) {
|
||||
int m = timer->remainingTime();
|
||||
if (m > ms) {
|
||||
timer->stop();
|
||||
} else return;
|
||||
}
|
||||
timer->setSingleShot(true);
|
||||
timer->start(ms);
|
||||
}
|
||||
void gGraphView::resetLayout()
|
||||
{
|
||||
|
@ -160,8 +160,7 @@ EventDataType gLineChart::Maxy()
|
||||
bool gLineChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
if (graph->graphView()->metaSelect())
|
||||
graph->timedRedraw(30);
|
||||
Q_UNUSED(graph)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -279,7 +278,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
if ((time > minx) && (time < maxx)) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -493,6 +493,28 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
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++) {
|
||||
totalcounts[i] = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user