X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fheader.cpp;h=780b1e3db5f9894c39e845fd6a549e855976038a;hb=650e2e5fd465119615b9b969d15cc9fb11f18aa4;hp=1dee05f4c7df0b4aa80f9f6ec39f2771f314e3c5;hpb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;p=pulseview.git diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 1dee05f4..780b1e3d 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -18,12 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "header.h" -#include "view.h" +#include "header.hpp" +#include "view.hpp" -#include "signal.h" -#include "tracegroup.h" -#include "../sigsession.h" +#include "signal.hpp" +#include "tracegroup.hpp" #include #include @@ -36,7 +35,8 @@ #include #include -#include +#include +#include using boost::make_filter_iterator; using std::dynamic_pointer_cast; @@ -60,8 +60,7 @@ static bool item_selected(shared_ptr r) } Header::Header(View &parent) : - MarginWidget(parent), - dragging_(false) + MarginWidget(parent) { setFocusPolicy(Qt::ClickFocus); setMouseTracking(true); @@ -75,15 +74,15 @@ QSize Header::sizeHint() const QRectF max_rect(-Padding, 0, Padding, 0); for (auto &i : view_) if (i->enabled()) - max_rect = max_rect.united(i->label_rect(0)); + max_rect = max_rect.united(i->label_rect(QRect())); return QSize(max_rect.width() + Padding + BaselineOffset, 0); } shared_ptr Header::get_mouse_over_row_item(const QPoint &pt) { - const int w = width() - BaselineOffset; + const QRect r(0, 0, width() - BaselineOffset, height()); for (auto &i : view_) - if (i->enabled() && i->label_rect(w).contains(pt)) + if (i->enabled() && i->label_rect(r).contains(pt)) return i; return shared_ptr(); } @@ -113,7 +112,7 @@ void Header::paintEvent(QPaintEvent*) // The trace labels are not drawn with the arrows exactly on the // left edge of the widget, because then the selection shadow // would be clipped away. - const int w = width() - BaselineOffset; + const QRect rect(0, 0, width() - BaselineOffset, height()); vector< shared_ptr > row_items( view_.begin(), view_.end()); @@ -130,8 +129,8 @@ void Header::paintEvent(QPaintEvent*) assert(r); const bool highlight = !dragging_ && - r->label_rect(w).contains(mouse_point_); - r->paint_label(painter, w, highlight); + r->label_rect(rect).contains(mouse_point_); + r->paint_label(painter, rect, highlight); } painter.end();