projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #615 by opening the output stream only if needed
[pulseview.git]
/
pv
/
view
/
timemarker.cpp
diff --git
a/pv/view/timemarker.cpp
b/pv/view/timemarker.cpp
index 894f023bf11c4d547db8649398905a8e57c8abe8..e4ef3c0e1cb5edff4a2765484ca93a3697431369 100644
(file)
--- a/
pv/view/timemarker.cpp
+++ b/
pv/view/timemarker.cpp
@@
-45,8
+45,8
@@
TimeMarker::TimeMarker(View &view, const QColor &colour, double time) :
TimeItem(view),
colour_(colour),
time_(time),
TimeItem(view),
colour_(colour),
time_(time),
- value_action_(
NULL
),
- value_widget_(
NULL
),
+ value_action_(
nullptr
),
+ value_widget_(
nullptr
),
updating_value_widget_(false)
{
}
updating_value_widget_(false)
{
}
@@
-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())