mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Passed PageUp/PageDown from compose search input to results list scroll.
This commit is contained in:
@@ -235,7 +235,8 @@ struct List {
|
||||
|
||||
List CreateList(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<History*> history) {
|
||||
not_null<History*> history,
|
||||
rpl::producer<not_null<QKeyEvent*>> scrollKeys) {
|
||||
auto list = List{
|
||||
base::make_unique_q<Ui::RpWidget>(parent),
|
||||
std::make_unique<ListController>(history),
|
||||
@@ -276,6 +277,16 @@ List CreateList(
|
||||
p.fillRect(r, st::dialogsBg);
|
||||
}, list.container->lifetime());
|
||||
|
||||
std::move(
|
||||
scrollKeys
|
||||
) | rpl::on_next([=](not_null<QKeyEvent*> e) {
|
||||
const auto delta = scroll->height();
|
||||
const auto now = scroll->scrollTop();
|
||||
scroll->scrollToY((e->key() == Qt::Key_PageUp)
|
||||
? (now - delta)
|
||||
: (now + delta));
|
||||
}, scroll->lifetime());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -897,7 +908,13 @@ ComposeSearch::Inner::Inner(
|
||||
, _history(history)
|
||||
, _topBar(base::make_unique_q<TopBar>(parent, window, history, from, query))
|
||||
, _bottomBar(base::make_unique_q<BottomBar>(parent, HasChooseFrom(history)))
|
||||
, _list(CreateList(parent, history))
|
||||
, _list(
|
||||
CreateList(
|
||||
parent,
|
||||
history,
|
||||
_topBar->keyEvents() | rpl::filter([](not_null<QKeyEvent*> e) {
|
||||
return e->key() == Qt::Key_PageDown || e->key() == Qt::Key_PageUp;
|
||||
})))
|
||||
, _apiSearch(history) {
|
||||
showAnimated();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user