connect(ruler_, SIGNAL(selection_changed()),
this, SIGNAL(selection_changed()));
+ connect(splitter_, SIGNAL(splitterMoved(int, int)),
+ this, SLOT(on_splitter_moved()));
+
connect(this, SIGNAL(hover_point_changed()),
this, SLOT(on_hover_point_changed()));
{
if (scale_ != scale) {
scale_ = scale;
- Q_EMIT scale_changed();
+ scale_changed();
}
}
{
if (offset_ != offset) {
offset_ = offset;
- Q_EMIT offset_changed();
+ offset_changed();
}
}
{
if (tick_prefix_ != tick_prefix) {
tick_prefix_ = tick_prefix;
- Q_EMIT tick_prefix_changed();
+ tick_prefix_changed();
}
}
{
if (tick_precision_ != tick_precision) {
tick_precision_ = tick_precision;
- Q_EMIT tick_precision_changed();
+ tick_precision_changed();
}
}
{
if (tick_period_ != tick_period) {
tick_period_ = tick_period;
- Q_EMIT tick_period_changed();
+ tick_period_changed();
}
}
{
if (time_unit_ != time_unit) {
time_unit_ = time_unit;
- Q_EMIT time_unit_changed();
+ time_unit_changed();
}
}
const int header_pane_width = splitter_->sizes().front();
const int header_width = header_->extended_size_hint().width();
- return (header_pane_width >= header_width);
+ // Allow for a slight margin of error so that we also accept
+ // slight differences when e.g. a label name change increased
+ // the overall width
+ return (header_pane_width >= (header_width - 10));
}
void View::update_layout()
void View::time_item_appearance_changed(bool label, bool content)
{
- if (label)
+ if (label) {
ruler_->update();
+
+ // Make sure the header pane width is updated, too
+ update_layout();
+ }
+
if (content)
viewport_->update();
}
lazy_event_handler_.start();
}
+void View::on_splitter_moved()
+{
+ // Setting the maximum width of the header widget doesn't work as
+ // expected because the splitter would allow the user to make the
+ // pane wider than that, creating empty space as a result.
+ // To make this work, we stricly enforce the maximum width by calling
+ update_layout();
+}
+
void View::h_scroll_value_changed(int value)
{
if (updating_scroll_)