From 3552a749555a8051509a3b378dbcd50be19bff81 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Fri, 17 Dec 2021 13:18:10 +0800 Subject: [PATCH] ruler tooltip text froma --- DSView/pv/view/ruler.cpp | 18 ++++++++++++++++++ qtpro/DSView.pro | 4 ++++ qtpro/DSView.pro.user | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index 905d9de7..7abc58e7 100755 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -96,12 +96,21 @@ QString Ruler::format_freq(double period, unsigned precision) const int prefix = ceil((order - FirstSIPrefixPower) / 3.0f); const double multiplier = pow(10.0, max(-prefix * 3.0 - FirstSIPrefixPower, 0.0)); + /* QString s; QTextStream ts(&s); ts.setRealNumberPrecision(precision); ts << fixed << 1 / (period * multiplier) << FreqPrefixes[prefix] << "Hz"; return s; + */ + + char buf[20] = {0}; + char format[10] = {0}; + sprintf(format, "%%.%df%%s", precision); + QString prev = FreqPrefixes[prefix] + "Hz"; + sprintf(buf, format, 1 / (period * multiplier), prev.toLatin1().data()); + return QString(buf); } } @@ -110,12 +119,21 @@ QString Ruler::format_time(double t, int prefix, { const double multiplier = pow(10.0, -prefix * 3 - FirstSIPrefixPower + 6.0); + /* QString s; QTextStream ts(&s); ts.setRealNumberPrecision(precision); ts << fixed << forcesign << (t * multiplier) / 1000000.0 << SIPrefixes[prefix] << "s"; return s; + */ + + char buf[20] = {0}; + char format[10] = {0}; + sprintf(format, "%%.%df%%s", precision); + QString prev = FreqPrefixes[prefix] + "s"; + sprintf(buf, format, (t * multiplier) / 1000000.0, prev.toLatin1().data()); + return QString(buf); } QString Ruler::format_time(double t) diff --git a/qtpro/DSView.pro b/qtpro/DSView.pro index 228a0d42..a122b7a1 100644 --- a/qtpro/DSView.pro +++ b/qtpro/DSView.pro @@ -22,6 +22,10 @@ QT += widgets #QMAKE_CFLAGS_ISYSTEM = -I +win32:{ + #QMAKE_LFLAGS += -shared +} + TARGET = DSView TEMPLATE = app diff --git a/qtpro/DSView.pro.user b/qtpro/DSView.pro.user index 79cd0fe4..152e14ab 100644 --- a/qtpro/DSView.pro.user +++ b/qtpro/DSView.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId