Changeset - dac6c8ef1e56
[Not reviewed]
default
0 1 0
Hasan Yavuz ÖZDERYA - 7 years ago 2019-01-12 15:30:06
hy@ozderya.net
fix tracker text shown when mouse cursor is not on widget
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/zoomer.cpp
Show inline comments
 
/*
 
  Copyright © 2018 Hasan Yavuz Özderya
 
  Copyright © 2019 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
  serialplot is free software: you can redistribute it and/or modify
 
  it under the terms of the GNU General Public License as published by
 
  the Free Software Foundation, either version 3 of the License, or
 
@@ -121,23 +121,26 @@ void Zoomer::drawTracker(QPainter* paint
 
        drawValues(painter);
 
    }
 
}
 

	
 
void Zoomer::drawValues(QPainter* painter) const
 
{
 
    auto tpos = trackerPosition();
 
    if (tpos.x() < 0) return;   // cursor not on window
 

	
 
    painter->save();
 

	
 
    double x = invTransform(trackerPosition()).x();
 
    double x = invTransform(tpos).x();
 
    auto values = findValues(x);
 

	
 
    // draw vertical line
 
    auto linePen = rubberBandPen();
 
    linePen.setStyle(Qt::DotLine);
 
    painter->setPen(linePen);
 
    const QRect pRect = pickArea().boundingRect().toRect();
 
    int px = trackerPosition().x();
 
    int px = tpos.x();
 
    painter->drawLine(px, pRect.top(), px, pRect.bottom());
 

	
 
    // draw sample values
 
    for (int ci = 0; ci < values.size(); ci++)
 
    {
 
        if (!dispChannels[ci]->visible()) continue;
0 comments (0 inline, 0 general)