---
 pv/view/cursorheader.cpp | 13 ++++++++++---
 pv/view/cursorheader.h   |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp
index 2092466..8dcb38d 100644
--- a/pv/view/cursorheader.cpp
+++ b/pv/view/cursorheader.cpp
@@ -23,6 +23,7 @@
 #include "view.h"
 
 #include <QApplication>
+#include <QFontMetrics>
 #include <QMouseEvent>
 
 #include <pv/widgets/popup.h>
@@ -32,11 +33,17 @@ using boost::shared_ptr;
 namespace pv {
 namespace view {
 
-const int CursorHeader::CursorHeaderHeight = 26;
+int CursorHeader::calculateTextHeight()
+{
+       QFontMetrics fm(font());
+       return fm.boundingRect(0, 0, INT_MAX, INT_MAX,
+               Qt::AlignLeft | Qt::AlignTop, "8").height();
+}
 
 CursorHeader::CursorHeader(View &parent) :
        MarginWidget(parent),
-       _dragging(false)
+       _dragging(false),
+       _textHeight(calculateTextHeight())
 {
        setMouseTracking(true);
 
@@ -48,7 +55,7 @@ CursorHeader::CursorHeader(View &parent) :
 
 QSize CursorHeader::sizeHint() const
 {
-       return QSize(0, CursorHeaderHeight);
+       return QSize(0, _textHeight + 10);
 }
 
 void CursorHeader::clear_selection()
diff --git a/pv/view/cursorheader.h b/pv/view/cursorheader.h
index 138925d..15588b4 100644
--- a/pv/view/cursorheader.h
+++ b/pv/view/cursorheader.h
@@ -51,11 +51,12 @@ private:
        void mousePressEvent(QMouseEvent *e);
        void mouseReleaseEvent(QMouseEvent *);
 
-       static const int CursorHeaderHeight;
+       int calculateTextHeight();
 
        boost::weak_ptr<TimeMarker> _grabbed_marker;
        QPoint _mouse_down_point;
        bool _dragging;
+       const int _textHeight;
 };
 
 } // namespace view
-- 
1.9.0


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to