X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fruler.cpp;h=aec3de979cf5171062df6777e78a42aaf4c74b03;hb=819f4c25391a9c74d3d2f528d462142d5c4aad4d;hp=a9a8452d47fc6784d6d736762ba4938ce3408895;hpb=b213ef0991a13af0c74ffe5c54382c5c455c5496;p=pulseview.git diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index a9a8452..aec3de9 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -37,12 +37,13 @@ #include -using namespace boost; -using namespace std; +using namespace Qt; +using boost::shared_ptr; namespace pv { namespace view { +const int Ruler::RulerHeight = 30; const int Ruler::MinorTickSubdivision = 4; const int Ruler::ScaleUnits[3] = {1, 2, 5}; @@ -74,7 +75,7 @@ QString Ruler::format_time(double t, unsigned int prefix, unsigned int precision) { const double multiplier = pow(10.0, - - prefix * 3 - FirstSIPrefixPower); + (int)- prefix * 3 - FirstSIPrefixPower); QString s; QTextStream ts(&s); @@ -84,9 +85,13 @@ QString Ruler::format_time(double t, unsigned int prefix, return s; } +QSize Ruler::sizeHint() const +{ + return QSize(0, RulerHeight); +} + void Ruler::paintEvent(QPaintEvent*) { - using namespace Qt; const double SpacingIncrement = 32.0f; const double MinValueSpacing = 32.0f; @@ -106,7 +111,7 @@ void Ruler::paintEvent(QPaintEvent*) const double min_period = _view.scale() * min_width; const int order = (int)floorf(log10f(min_period)); - const double order_decimal = pow(10, order); + const double order_decimal = pow(10.0, order); unsigned int unit = 0;