26 #include <QApplication> 39 using std::shared_ptr;
74 QFontMetrics
m(QApplication::font());
77 const QSizeF label_size(
80 const float top = rect.height() - label_size.height() -
82 const float height = label_size.height();
86 if (
time_ > other_time ||
87 (abs(
time_ - other_time).is_zero() &&
this > other.get()))
88 return QRectF(x, top, label_size.width(), height);
90 return QRectF(x - label_size.width(), top, label_size.width(), height);
95 QMenu *
const menu =
new QMenu(parent);
97 QAction *
const snap_disable =
new QAction(tr(
"Disable snapping"),
this);
98 snap_disable->setCheckable(
true);
100 connect(snap_disable, &QAction::toggled,
this, [=](
bool checked){
snapping_disabled_ = checked;});
101 menu->addAction(snap_disable);
110 return (cursors->first().get() ==
this) ?
111 cursors->second() : cursors->first();
const Ruler * ruler() const
util::TimeUnit time_unit() const
pv::util::Timestamp time_
shared_ptr< CursorPair > cursors() const
virtual QMenu * create_header_context_menu(QWidget *parent) override
pv::util::SIPrefix tick_prefix() const
float get_x() const override
pv::util::Timestamp get_ruler_time_from_absolute_time(const pv::util::Timestamp &abs_time) const
static const QSizeF LabelPadding
virtual QString get_text() const override
Cursor(View &view, double time)
shared_ptr< Cursor > get_other_cursor() const
bool cursors_shown() const
static QString format_time_with_distance(const pv::util::Timestamp &distance, const pv::util::Timestamp &t, pv::util::SIPrefix prefix=pv::util::SIPrefix::unspecified, pv::util::TimeUnit unit=pv::util::TimeUnit::Time, unsigned precision=0, bool sign=true)
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 24 >, boost::multiprecision::et_off > Timestamp
Timestamp type providing yoctosecond resolution.
virtual QString get_display_text() const
virtual QRectF label_rect(const QRectF &rect) const override
static const QColor FillColor
static const int ArrowSize
unsigned int tick_precision() const
virtual bool enabled() const override