X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fruler.cpp;h=f6ec4ac78d7d142a486d2347287bd4693816ca5c;hp=ab08a32011cdef2aad64f62cb8e2d4aaa8fdb14b;hb=d6128866e740f496a1bb3c9636e188648507fc3a;hpb=2d14193769fead2c7882c63246b12b0f80df23d5 diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index ab08a320..f6ec4ac7 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -35,10 +35,10 @@ using std::vector; namespace pv { namespace view { -const float Ruler::RulerHeight = 2.5f; // x Text Height +const float Ruler::RulerHeight = 2.5f; // x Text Height const int Ruler::MinorTickSubdivision = 4; -const float Ruler::HoverArrowSize = 0.5f; // x Text Height +const float Ruler::HoverArrowSize = 0.5f; // x Text Height Ruler::Ruler(View &parent) : MarginWidget(parent) @@ -128,8 +128,7 @@ shared_ptr Ruler::get_mouse_over_item(const QPoint &pt) void Ruler::paintEvent(QPaintEvent*) { if (!tick_position_cache_) { - auto ffunc = [this](const pv::util::Timestamp& t) - { + auto ffunc = [this](const pv::util::Timestamp& t) { return format_time_with_distance( this->view_.tick_period(), t, @@ -138,12 +137,12 @@ void Ruler::paintEvent(QPaintEvent*) this->view_.tick_precision()); }; - tick_position_cache_.emplace(calculate_tick_positions( + tick_position_cache_ = calculate_tick_positions( view_.tick_period(), view_.offset(), view_.scale(), width(), - ffunc)); + ffunc); } const int ValueMargin = 3; @@ -226,9 +225,9 @@ Ruler::TickPositions Ruler::calculate_tick_positions( return tp; } -void Ruler::mouseDoubleClickEvent(QMouseEvent *e) +void Ruler::mouseDoubleClickEvent(QMouseEvent *event) { - view_.add_flag(view_.offset() + ((double)e->x() + 0.5) * view_.scale()); + view_.add_flag(view_.offset() + ((double)event->x() + 0.5) * view_.scale()); } void Ruler::draw_hover_mark(QPainter &p, int text_height)