Show line cursor in overview

This commit is contained in:
Mark Watkins 2014-07-21 19:39:26 +10:00
parent 861dd5cfca
commit b59efb0afb
5 changed files with 37 additions and 10 deletions

View File

@ -128,8 +128,9 @@ void gFlagsGroup::paint(QPainter &painter, gGraph &g, const QRegion &region)
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;

View File

@ -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;

View File

@ -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()
{

View File

@ -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 &region)
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);
}

View File

@ -493,6 +493,28 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
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;