]> sigrok.org Git - pulseview.git/commitdiff
TimeMarker: Renamed get_label_rect, and made it take a const QRectF&
authorJoel Holdsworth <redacted>
Sun, 7 Dec 2014 10:59:52 +0000 (10:59 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:16 +0000 (18:06 +0100)
pv/view/cursor.cpp
pv/view/cursor.hpp
pv/view/cursorheader.cpp
pv/view/cursorpair.cpp
pv/view/cursorpair.hpp
pv/view/timemarker.cpp
pv/view/timemarker.hpp

index 836d0e93d758fd911e371ef5383eda291ffa41c6..5f33416050d721b21af2b00835dc341259aeb391 100644 (file)
@@ -55,7 +55,7 @@ QString Cursor::get_text() const
        return pv::util::format_time(time_, view_.tick_prefix(), 2);
 }
 
-QRectF Cursor::get_label_rect(const QRect &rect) const
+QRectF Cursor::label_rect(const QRectF &rect) const
 {
        const shared_ptr<Cursor> other(get_other_cursor());
        assert(other);
index b23bd642b47130446a21b8fcf7b67c812acb7dc5..03b97a17789e948e4062dc44f484274d238fdcc7 100644 (file)
@@ -63,7 +63,7 @@ public:
         * @param rect The rectangle of the ruler client area.
         * @return Returns the label rectangle.
         */
-       QRectF get_label_rect(const QRect &rect) const;
+       QRectF label_rect(const QRectF &rect) const;
 
 private:
        std::shared_ptr<Cursor> get_other_cursor() const;
index 076b2a7fc2ecd677ea12b99e16d08f7f3f1c2910..2835750b9647bcd2a5fd41a490cb13dadbafb7db 100644 (file)
@@ -108,10 +108,10 @@ void CursorHeader::mousePressEvent(QMouseEvent *e)
 
                if (view_.cursors_shown()) {
                        shared_ptr<CursorPair> cursors(view_.cursors());
-                       if (cursors->first()->get_label_rect(
+                       if (cursors->first()->label_rect(
                                rect()).contains(e->pos()))
                                grabbed_marker_ = cursors->first();
-                       else if (cursors->second()->get_label_rect(
+                       else if (cursors->second()->label_rect(
                                rect()).contains(e->pos()))
                                grabbed_marker_ = cursors->second();
                }
index 0370793d0407b9a9d8db11dc55e592f50ef53732..8a0ecbf20b14c618ed587645f90b91a24cd69805 100644 (file)
@@ -70,7 +70,7 @@ pv::widgets::Popup* CursorPair::create_popup(QWidget *parent)
        return nullptr;
 }
 
-QRectF CursorPair::get_label_rect(const QRect &rect) const
+QRectF CursorPair::label_rect(const QRectF &rect) const
 {
        const QSizeF label_size(
                text_size_.width() + View::LabelPadding.width() * 2,
@@ -98,7 +98,7 @@ void CursorPair::draw_markers(QPainter &p, const QRect &rect)
        const unsigned int prefix = view_.tick_prefix();
 
        compute_text_size(p, prefix);
-       QRectF delta_rect(get_label_rect(rect));
+       QRectF delta_rect(label_rect(rect));
 
        const int radius = delta_rect.height() / 2;
        const QRectF text_rect(delta_rect.intersected(
index 12ed76af9ce18012a74a18456cb889c292163e54..78780916504cda37434c641b9c0da6c001745a46 100644 (file)
@@ -65,7 +65,7 @@ public:
        pv::widgets::Popup* create_popup(QWidget *parent);
 
 public:
-       QRectF get_label_rect(const QRect &rect) const;
+       QRectF label_rect(const QRectF &rect) const;
 
        void draw_markers(QPainter &p, const QRect &rect);
 
index 34b2699bd6722fe9b5f3b169266f3341eb3eabad..eebac024cca0c81608d5452a560544e235081813 100644 (file)
@@ -87,7 +87,7 @@ void TimeMarker::paint(QPainter &p, const QRect &rect)
        p.drawLine(QPointF(x, rect.top()), QPointF(x, rect.bottom()));
 }
 
-QRectF TimeMarker::get_label_rect(const QRect &rect) const
+QRectF TimeMarker::label_rect(const QRectF &rect) const
 {
        const float x = (time_ - view_.offset()) / view_.scale();
 
@@ -113,7 +113,7 @@ void TimeMarker::paint_label(QPainter &p, const QRect &rect)
                return;
 
        const qreal x = (time_ - view_.offset()) / view_.scale();
-       const QRectF r(get_label_rect(rect));
+       const QRectF r(label_rect(rect));
 
        const QPointF points[] = {
                r.topLeft(),
index 24688ebc2e3d91a6ef319e932948026971668198..4e9d1fa2ebf5158842b6314e0b906da5c318c6d7 100644 (file)
@@ -89,7 +89,7 @@ public:
         * @param rect The rectangle of the ruler client area.
         * @return Returns the label rectangle.
         */
-       virtual QRectF get_label_rect(const QRect &rect) const;
+       virtual QRectF label_rect(const QRectF &rect) const;
 
        /**
         * Paints the marker's label to the ruler.