Ignore right click on preview.

This commit is contained in:
John Preston 2024-05-29 10:12:56 +04:00
parent 465fc42718
commit d2e6003521
1 changed files with 13 additions and 10 deletions

View File

@ -426,16 +426,19 @@ void Item::setupHistory() {
_scroll->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
if (e->type() == QEvent::MouseButtonPress) {
const auto relative = Ui::MapFrom(
_inner.data(),
_scroll.get(),
static_cast<QMouseEvent*>(e.get())->pos());
if (const auto view = _inner->lookupItemByY(relative.y())) {
_actions.fire(ChatPreviewAction{
.openItemId = view->data()->fullId(),
});
} else {
_actions.fire(ChatPreviewAction{});
const auto button = static_cast<QMouseEvent*>(e.get())->button();
if (button == Qt::LeftButton) {
const auto relative = Ui::MapFrom(
_inner.data(),
_scroll.get(),
static_cast<QMouseEvent*>(e.get())->pos());
if (const auto view = _inner->lookupItemByY(relative.y())) {
_actions.fire(ChatPreviewAction{
.openItemId = view->data()->fullId(),
});
} else {
_actions.fire(ChatPreviewAction{});
}
}
}
}, lifetime());