From: Joel Holdsworth Date: Sat, 20 Dec 2014 15:59:06 +0000 (+0000) Subject: ViewItem: Moved in LabelPadding X-Git-Tag: pulseview-0.3.0~331 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ec39632d1267a42cb858ac6ad7c98486886a46a0;p=pulseview.git ViewItem: Moved in LabelPadding --- diff --git a/pv/view/cursor.cpp b/pv/view/cursor.cpp index b5fcf9d6..0ea6f5ab 100644 --- a/pv/view/cursor.cpp +++ b/pv/view/cursor.cpp @@ -66,8 +66,8 @@ QRectF Cursor::label_rect(const QRectF &rect) const QSize text_size = m.boundingRect(get_text()).size(); const QSizeF label_size( - text_size.width() + View::LabelPadding.width() * 2, - text_size.height() + View::LabelPadding.height() * 2); + text_size.width() + LabelPadding.width() * 2, + text_size.height() + LabelPadding.height() * 2); const float top = rect.height() - label_size.height() - TimeMarker::ArrowSize - 0.5f; const float height = label_size.height(); diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 0395d034..c3753e65 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -85,8 +85,8 @@ pv::widgets::Popup* CursorPair::create_popup(QWidget *parent) QRectF CursorPair::label_rect(const QRectF &rect) const { const QSizeF label_size( - text_size_.width() + View::LabelPadding.width() * 2, - text_size_.height() + View::LabelPadding.height() * 2); + text_size_.width() + LabelPadding.width() * 2, + text_size_.height() + LabelPadding.height() * 2); const pair offsets(get_cursor_offsets()); const pair normal_offsets( (offsets.first < offsets.second) ? offsets : diff --git a/pv/view/timemarker.cpp b/pv/view/timemarker.cpp index 2b171844..47ba3455 100644 --- a/pv/view/timemarker.cpp +++ b/pv/view/timemarker.cpp @@ -89,8 +89,8 @@ QRectF TimeMarker::label_rect(const QRectF &rect) const const float text_height = m.height(); const QSizeF label_size( - text_width + View::LabelPadding.width() * 2, - text_height + View::LabelPadding.height() * 2); + text_width + LabelPadding.width() * 2, + text_height + LabelPadding.height() * 2); const float top = rect.height() - label_size.height() - TimeMarker::ArrowSize - 0.5f; const float height = label_size.height(); diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index 24f97fb7..df5a954b 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -151,8 +151,8 @@ QRectF Trace::label_rect(const QRectF &rect) const const QSize text_size( m.boundingRect(QRect(), 0, name_).width(), m.height()); const QSizeF label_size( - text_size.width() + View::LabelPadding.width() * 2, - ceilf((text_size.height() + View::LabelPadding.height() * 2) / 2) * 2); + text_size.width() + LabelPadding.width() * 2, + ceilf((text_size.height() + LabelPadding.height() * 2) / 2) * 2); const float half_height = label_size.height() / 2; return QRectF( rect.right() - half_height - label_size.width() - 0.5, diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 59127c36..e4b22c2f 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -84,8 +84,6 @@ const int View::MaxScrollValue = INT_MAX / 2; const int View::ScaleUnits[3] = {1, 2, 5}; -const QSizeF View::LabelPadding(4, 0); - View::View(Session &session, QWidget *parent) : QAbstractScrollArea(parent), session_(session), diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 167f43de..9c7c13bc 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -67,9 +67,6 @@ private: static const int ScaleUnits[3]; -public: - static const QSizeF LabelPadding; - public: explicit View(Session &session, QWidget *parent = 0); diff --git a/pv/view/viewitem.cpp b/pv/view/viewitem.cpp index b833b4bb..ae5c427a 100644 --- a/pv/view/viewitem.cpp +++ b/pv/view/viewitem.cpp @@ -29,6 +29,7 @@ namespace pv { namespace view { +const QSizeF ViewItem::LabelPadding(4, 0); const int ViewItem::HighlightRadius = 3; ViewItem::ViewItem() : diff --git a/pv/view/viewitem.hpp b/pv/view/viewitem.hpp index 3e6801fe..1e02ffde 100644 --- a/pv/view/viewitem.hpp +++ b/pv/view/viewitem.hpp @@ -44,6 +44,7 @@ class ViewItem : public QObject Q_OBJECT public: + static const QSizeF LabelPadding; static const int HighlightRadius; public: