# HG changeset patch # User Hasan Yavuz ÖZDERYA # Date 2017-04-12 15:49:09 # Node ID d4a271f3d46a61e4119e6f55afd478db51fe7a6e # Parent ca7d3d5f78667a1be9e810669d767b9ce1946899 show zoom selection size in the tracker text diff --git a/src/zoomer.cpp b/src/zoomer.cpp --- a/src/zoomer.cpp +++ b/src/zoomer.cpp @@ -1,5 +1,5 @@ /* - Copyright © 2016 Hasan Yavuz Özderya + Copyright © 2017 Hasan Yavuz Özderya This file is part of serialplot. @@ -52,3 +52,19 @@ void Zoomer::zoom( const QRectF & rect) ScrollZoomer::zoom(rect); } + +QwtText Zoomer::trackerTextF(const QPointF& pos) const +{ + QwtText b = ScrollZoomer::trackerTextF(pos); + + const QPolygon pa = selection(); + const QRectF rect = invTransform(QRect(pa.first(), pa.last()).normalized()); + + QString sizeText = QString(" [%1, %2]").\ + arg(rect.width(), 0, 'g', 4).\ + arg(rect.height(), 0, 'g', 4); + + b.setText(b.text() + sizeText); + + return b; +} diff --git a/src/zoomer.h b/src/zoomer.h --- a/src/zoomer.h +++ b/src/zoomer.h @@ -1,5 +1,5 @@ /* - Copyright © 2016 Hasan Yavuz Özderya + Copyright © 2017 Hasan Yavuz Özderya This file is part of serialplot. @@ -33,6 +33,10 @@ public: signals: void unzoomed(); + +protected: + /// Re-implemented to display selection size in the tracker text. + QwtText trackerTextF(const QPointF &pos) const; }; #endif // ZOOMER_H