Redirected wheel events from custom top bar to section content.

This commit is contained in:
23rd 2022-05-24 03:27:36 +03:00
parent 141f96590b
commit c123f9e119
3 changed files with 16 additions and 0 deletions

View File

@ -263,6 +263,15 @@ void ContentWidget::setPaintPadding(const style::margins &padding) {
_paintPadding = padding;
}
void ContentWidget::setViewport(
rpl::producer<not_null<QEvent*>> &&events) const {
std::move(
events
) | rpl::start_with_next([=](not_null<QEvent*> e) {
_scroll->viewportEvent(e);
}, _scroll->lifetime());
}
void ContentWidget::saveChanges(FnMut<void()> done) {
done();
}

View File

@ -107,6 +107,8 @@ protected:
void setPaintPadding(const style::margins &padding);
void setViewport(rpl::producer<not_null<QEvent*>> &&events) const;
private:
RpWidget *doSetInnerWidget(object_ptr<RpWidget> inner);
void updateControlsGeometry();

View File

@ -165,6 +165,11 @@ Widget::Widget(
}, _inner->lifetime());
setPaintPadding({ 0, _pinnedToTop->minimumHeight(), 0, 0 });
setViewport(_pinnedToTop->events(
) | rpl::filter([](not_null<QEvent*> e) {
return e->type() == QEvent::Wheel;
}));
}
}