return roundf(((time_ - view_.offset()) / view_.scale()).convert_to<float>()) + 0.5f;
}
-const pv::util::Timestamp TimeMarker::delta(const pv::util::Timestamp& other) const
-{
- return other - time_;
-}
-
QPoint TimeMarker::drag_point(const QRect &rect) const
{
(void)rect;
{
QFontMetrics m(QApplication::font());
const QSizeF text_size(
- max(m.boundingRect(get_text()).size().width(), ArrowSize),
+ max(m.boundingRect(get_display_text()).size().width(), ArrowSize),
m.height());
const QSizeF label_size(text_size + LabelPadding * 2);
const float top = rect.height() - label_size.height() -
return QRectF(x - h / 2.0f, pp.top(), h, pp.height());
}
+QString TimeMarker::get_display_text() const
+{
+ return get_text();
+}
+
+void TimeMarker::set_text(const QString &text)
+{
+ (void)text;
+}
+
void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
{
if (!enabled())
p.drawPolygon(points, countof(points));
p.setPen(select_text_color(color_));
- p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, get_text());
+ p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, get_display_text());
}
void TimeMarker::paint_fore(QPainter &p, ViewItemPaintParams &pp)
popup->set_position(parent->mapToGlobal(
drag_point(parent->rect())), Popup::Bottom);
+ connect(popup, SIGNAL(closed()), this, SLOT(on_popup_closed()));
+
QFormLayout *const form = new QFormLayout(popup);
popup->setLayout(form);
return popup;
}
+void TimeMarker::on_popup_closed()
+{
+ GlobalSettings settings;
+ if (!settings.value(GlobalSettings::Key_View_KeepRulerItemSelected).toBool())
+ select(false);
+}
+
void TimeMarker::on_value_changed(const pv::util::Timestamp& value)
{
set_time(view_.ruler()->get_absolute_time_from_ruler_time(value));