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.
 

	
 
@@ -124,9 +124,12 @@ void Zoomer::drawTracker(QPainter* paint
 

	
 
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
 
@@ -134,7 +137,7 @@ void Zoomer::drawValues(QPainter* painte
 
    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
0 comments (0 inline, 0 general)