connect(set_zero_position, SIGNAL(triggered()), this, SLOT(on_setZeroPosition()));
menu->addAction(set_zero_position);
+ if (view_.zero_offset().convert_to<double>() != 0) {
+ QAction *const reset_zero_position = new QAction(tr("Reset zero point"), this);
+ connect(reset_zero_position, SIGNAL(triggered()), this, SLOT(on_resetZeroPosition()));
+ menu->addAction(reset_zero_position);
+ }
+
QAction *const toggle_hover_marker = new QAction(this);
connect(toggle_hover_marker, SIGNAL(triggered()), this, SLOT(on_toggleHoverMarker()));
menu->addAction(toggle_hover_marker);
const int rightedge = width();
const int x_tick = tick.first;
if ((x_tick > leftedge) && (x_tick < rightedge)) {
- const int x_left_bound = QFontMetrics(font()).width(tick.second) / 2;
+ const int x_left_bound = util::text_width(QFontMetrics(font()), tick.second) / 2;
const int x_right_bound = rightedge - x_left_bound;
const int x_legend = min(max(x_tick, x_left_bound), x_right_bound);
p.drawText(x_legend, ValueMargin, 0, text_height,
view_.set_zero_position(get_absolute_time_from_x_pos(mouse_down_point_.x()));
}
+void Ruler::on_resetZeroPosition()
+{
+ view_.reset_zero_position();
+}
+
void Ruler::on_toggleHoverMarker()
{
GlobalSettings settings;