]> sigrok.org Git - pulseview.git/commitdiff
Header: Hit-test items in reverse order
authorJoel Holdsworth <redacted>
Sun, 6 Sep 2015 14:30:30 +0000 (08:30 -0600)
committerJoel Holdsworth <redacted>
Sun, 18 Oct 2015 21:32:29 +0000 (15:32 -0600)
pv/view/header.cpp

index 58c21e596c7ab9ace1beb392a5510b270609dddf..bfb75532aa58ad7508db13b1243ce051613e131c 100644 (file)
@@ -92,9 +92,9 @@ shared_ptr<ViewItem> Header::get_mouse_over_item(const QPoint &pt)
        const QRect r(0, 0, width() - BaselineOffset, height());
        const vector<shared_ptr<TraceTreeItem>> items(
                view_.list_by_type<TraceTreeItem>());
-       for (auto &i : items)
-               if (i->enabled() && i->label_rect(r).contains(pt))
-                       return i;
+       for (auto i = items.rbegin(); i != items.rend(); i++)
+               if ((*i)->enabled() && (*i)->label_rect(r).contains(pt))
+                       return *i;
        return shared_ptr<TraceTreeItem>();
 }