projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Session: Fixed header guard
[pulseview.git]
/
pv
/
view
/
timemarker.cpp
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index 614275cf98e04d1d559d211cae6bf9740f595b15..1e5b8206e54165ebc3cc36e20181eef686c422ce 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-74,9
+74,9
@@
float TimeMarker::get_x() const
return (time_ - view_.offset()) / view_.scale();
}
return (time_ - view_.offset()) / view_.scale();
}
-QPoint TimeMarker::point() const
+QPoint TimeMarker::point(
const QRect &rect
) const
{
{
- return QPoint(get_x(),
0
);
+ return QPoint(get_x(),
rect.bottom()
);
}
QRectF TimeMarker::label_rect(const QRectF &rect) const
}
QRectF TimeMarker::label_rect(const QRectF &rect) const
@@
-88,11
+88,18
@@
QRectF TimeMarker::label_rect(const QRectF &rect) const
const QSizeF label_size(text_size + LabelPadding * 2);
const float top = rect.height() - label_size.height() -
TimeMarker::ArrowSize - 0.5f;
const QSizeF label_size(text_size + LabelPadding * 2);
const float top = rect.height() - label_size.height() -
TimeMarker::ArrowSize - 0.5f;
- const float x =
(time_ - view_.offset()) / view_.scale
();
+ const float x =
get_x
();
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
+{
+ const float x = get_x();
+ const float h = QFontMetrics(QApplication::font()).height();
+ return QRectF(x - h / 2.0f, rect.top(), h, rect.height());
+}
+
void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
{
if (!enabled())
void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
{
if (!enabled())
@@
-159,6
+166,9
@@
pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
using pv::widgets::Popup;
Popup *const popup = new Popup(parent);
using pv::widgets::Popup;
Popup *const popup = new Popup(parent);
+ popup->set_position(parent->mapToGlobal(
+ point(parent->rect())), Popup::Bottom);
+
QFormLayout *const form = new QFormLayout(popup);
popup->setLayout(form);
QFormLayout *const form = new QFormLayout(popup);
popup->setLayout(form);