const double View::MaxScale = 1e9;
const double View::MinScale = 1e-15;
-const int View::LabelMarginWidth = 70;
-const int View::RulerHeight = 30;
-
const int View::MaxScrollValue = INT_MAX / 2;
const int View::SignalHeight = 30;
connect(_cursors.second().get(), SIGNAL(time_changed()),
this, SLOT(marker_time_changed()));
+ connect(_header, SIGNAL(geometry_updated()),
+ this, SLOT(on_geometry_updated()));
connect(_header, SIGNAL(signals_moved()),
this, SLOT(on_signals_moved()));
connect(_ruler, SIGNAL(selection_changed()),
this, SIGNAL(selection_changed()));
- setViewportMargins(LabelMarginWidth, RulerHeight, 0, 0);
setViewport(_viewport);
_viewport->installEventFilter(this);
areaSize.height());
}
+void View::update_layout()
+{
+ setViewportMargins(_header->sizeHint().width(),
+ _ruler->sizeHint().height(), 0, 0);
+ _ruler->setGeometry(_viewport->x(), 0,
+ _viewport->width(), _viewport->y());
+ _header->setGeometry(0, _viewport->y(),
+ _viewport->x(), _viewport->height());
+ update_scroll();
+}
+
bool View::compare_trace_v_offsets(const shared_ptr<Trace> &a,
const shared_ptr<Trace> &b)
{
void View::resizeEvent(QResizeEvent*)
{
- _ruler->setGeometry(_viewport->x(), 0,
- _viewport->width(), _viewport->y());
- _header->setGeometry(0, _viewport->y(),
- _viewport->x(), _viewport->height());
- update_scroll();
+ update_layout();
}
void View::h_scroll_value_changed(int value)
offset += SignalHeight + 2 * SignalMargin;
}
+ update_layout();
normalize_layout();
}
signals_moved();
}
+void View::on_geometry_updated()
+{
+ update_layout();
+}
+
} // namespace view
} // namespace pv