mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Added ability to append pinned to top content to settings sections.
This commit is contained in:
parent
2f5db08c9b
commit
639ed8b973
3 changed files with 20 additions and 1 deletions
|
@ -47,11 +47,25 @@ Widget::Widget(
|
|||
, _type(controller->section().settingsType())
|
||||
, _inner(
|
||||
setInnerWidget(
|
||||
_type()->create(this, controller->parentController()))) {
|
||||
_type()->create(this, controller->parentController())))
|
||||
, _pinnedToTop(_inner->createPinnedToTop(this)) {
|
||||
_inner->sectionShowOther(
|
||||
) | rpl::start_with_next([=](Type type) {
|
||||
controller->showSettings(type);
|
||||
}, _inner->lifetime());
|
||||
|
||||
if (_pinnedToTop) {
|
||||
_inner->widthValue(
|
||||
) | rpl::start_with_next([=](int w) {
|
||||
_pinnedToTop->resizeToWidth(w);
|
||||
setScrollTopSkip(_pinnedToTop->height());
|
||||
}, _pinnedToTop->lifetime());
|
||||
|
||||
_pinnedToTop->heightValue(
|
||||
) | rpl::start_with_next([=](int h) {
|
||||
setScrollTopSkip(h);
|
||||
}, _pinnedToTop->lifetime());
|
||||
}
|
||||
}
|
||||
|
||||
Widget::~Widget() = default;
|
||||
|
|
|
@ -81,6 +81,7 @@ private:
|
|||
Type _type = Type();
|
||||
|
||||
not_null<::Settings::AbstractSection*> _inner;
|
||||
QPointer<Ui::RpWidget> _pinnedToTop;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -80,6 +80,10 @@ public:
|
|||
}
|
||||
virtual void showFinished() {
|
||||
}
|
||||
[[nodiscard]] virtual QPointer<Ui::RpWidget> createPinnedToTop(
|
||||
not_null<QWidget*> parent) {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename SectionType>
|
||||
|
|
Loading…
Add table
Reference in a new issue