projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ab6d2ea
)
ViewItem: Make hit_box_rect take ViewItemPaintParams
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Mon, 7 Sep 2015 02:29:31 +0000
(20:29 -0600)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 18 Oct 2015 21:32:30 +0000
(15:32 -0600)
pv/view/timemarker.cpp
patch
|
blob
|
history
pv/view/timemarker.hpp
patch
|
blob
|
history
pv/view/trace.cpp
patch
|
blob
|
history
pv/view/trace.hpp
patch
|
blob
|
history
pv/view/viewitem.cpp
patch
|
blob
|
history
pv/view/viewitem.hpp
patch
|
blob
|
history
pv/view/viewport.cpp
patch
|
blob
|
history
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index 8c136a18189285e3a965af58e49ad0642f002b87..b5662e4b6ba32e3ec6b90945f11799cf68cc59ce 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-95,11
+95,11
@@
QRectF TimeMarker::label_rect(const QRectF &rect) const
return QRectF(QPointF(x - label_size.width() / 2, top), label_size);
}
return QRectF(QPointF(x - label_size.width() / 2, top), label_size);
}
-QRectF TimeMarker::hit_box_rect(const
QRectF &rect
) const
+QRectF TimeMarker::hit_box_rect(const
ViewItemPaintParams &pp
) const
{
const float x = get_x();
const float h = QFontMetrics(QApplication::font()).height();
{
const float x = get_x();
const float h = QFontMetrics(QApplication::font()).height();
- return QRectF(x - h / 2.0f,
rect.top(), h, rect
.height());
+ return QRectF(x - h / 2.0f,
pp.top(), h, pp
.height());
}
void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
}
void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
diff --git
a/pv/view/timemarker.hpp
b/pv/view/timemarker.hpp
index 371b6e4a54ce607edbdfd7dc3ead53c55e9ae447..1116eb460d3193987931d6b762cf6a8a229782c3 100644
(file)
--- a/
pv/view/timemarker.hpp
+++ b/
pv/view/timemarker.hpp
@@
-88,7
+88,7
@@
public:
* @param rect the rectangle of the viewport area.
* @return Returns the rectangle of the hit-box.
*/
* @param rect the rectangle of the viewport area.
* @return Returns the rectangle of the hit-box.
*/
- QRectF hit_box_rect(const
QRectF &rect
) const;
+ QRectF hit_box_rect(const
ViewItemPaintParams &pp
) const;
/**
* Gets the text to show in the marker.
/**
* Gets the text to show in the marker.
diff --git
a/pv/view/trace.cpp
b/pv/view/trace.cpp
index 729b0b4c1588ff6ae93cc5c152dbdcd2e46994cc..2e15ca958a1da81af2ebba507328da0b9cb801b6 100644
(file)
--- a/
pv/view/trace.cpp
+++ b/
pv/view/trace.cpp
@@
-163,11
+163,11
@@
QRectF Trace::label_rect(const QRectF &rect) const
label_size.height());
}
label_size.height());
}
-QRectF Trace::hit_box_rect(const
QRectF &rect
) const
+QRectF Trace::hit_box_rect(const
ViewItemPaintParams &pp
) const
{
const float h = QFontMetrics(QApplication::font()).height();
{
const float h = QFontMetrics(QApplication::font()).height();
- return QRectF(
rect
.left(), get_visual_y() - h / 2.0f,
-
rect
.width(), h);
+ return QRectF(
pp
.left(), get_visual_y() - h / 2.0f,
+
pp
.width(), h);
}
void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
}
void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
diff --git
a/pv/view/trace.hpp
b/pv/view/trace.hpp
index 8c99191790e6aa7e6c783a0c0b5d9a95f678c19d..677f366b477f7b1caaaae3bfb03a523ff3a51a0d 100644
(file)
--- a/
pv/view/trace.hpp
+++ b/
pv/view/trace.hpp
@@
-78,7
+78,7
@@
public:
* @param rect the rectangle of the viewport area.
* @return Returns the rectangle of the hit-box.
*/
* @param rect the rectangle of the viewport area.
* @return Returns the rectangle of the hit-box.
*/
- QRectF hit_box_rect(const
QRectF &rect
) const;
+ QRectF hit_box_rect(const
ViewItemPaintParams &pp
) const;
/**
* Paints the signal label.
/**
* Paints the signal label.
diff --git
a/pv/view/viewitem.cpp
b/pv/view/viewitem.cpp
index 6ad6f6b64fbb515eb3426e13d3806754e8f862cc..a63d4d38ed7a3c6932f891883ab8918df70097cc 100644
(file)
--- a/
pv/view/viewitem.cpp
+++ b/
pv/view/viewitem.cpp
@@
-70,9
+70,9
@@
QRectF ViewItem::label_rect(const QRectF &rect) const
return QRectF();
}
return QRectF();
}
-QRectF ViewItem::hit_box_rect(const
QRectF &rect
) const
+QRectF ViewItem::hit_box_rect(const
ViewItemPaintParams &pp
) const
{
{
- (void)
rect
;
+ (void)
pp
;
return QRectF();
}
return QRectF();
}
diff --git
a/pv/view/viewitem.hpp
b/pv/view/viewitem.hpp
index 32b9f995fedb642783964b6287e68fbe36c9e131..648be84e64384a6fa382a503ee28f0892a480619 100644
(file)
--- a/
pv/view/viewitem.hpp
+++ b/
pv/view/viewitem.hpp
@@
-109,7
+109,7
@@
public:
* @return Returns the rectangle of the hit-box.
* @remarks The default implementation returns an empty hit-box.
*/
* @return Returns the rectangle of the hit-box.
* @remarks The default implementation returns an empty hit-box.
*/
- virtual QRectF hit_box_rect(const
QRectF &rect
) const;
+ virtual QRectF hit_box_rect(const
ViewItemPaintParams &pp
) const;
/**
* Paints the signal label.
/**
* Paints the signal label.
diff --git
a/pv/view/viewport.cpp
b/pv/view/viewport.cpp
index 91b27d3ffb02ab383c3d2c801507191610a072e6..1b3d371748b844255e0f5ef8b29b311d8130a538 100644
(file)
--- a/
pv/view/viewport.cpp
+++ b/
pv/view/viewport.cpp
@@
-57,10
+57,11
@@
Viewport::Viewport(View &parent) :
shared_ptr<ViewItem> Viewport::get_mouse_over_item(const QPoint &pt)
{
shared_ptr<ViewItem> Viewport::get_mouse_over_item(const QPoint &pt)
{
+ const ViewItemPaintParams pp(rect(), view_.scale(), view_.offset());
const vector< shared_ptr<ViewItem> > items(this->items());
for (auto i = items.rbegin(); i != items.rend(); i++)
if ((*i)->enabled() &&
const vector< shared_ptr<ViewItem> > items(this->items());
for (auto i = items.rbegin(); i != items.rend(); i++)
if ((*i)->enabled() &&
- (*i)->hit_box_rect(
rect()
).contains(pt))
+ (*i)->hit_box_rect(
pp
).contains(pt))
return *i;
return nullptr;
}
return *i;
return nullptr;
}