Fix scrolling the room list using touch

This commit is contained in:
Nicolas Werner 2020-12-15 00:17:44 +01:00
parent 97688763f6
commit b8ce9d543d
2 changed files with 32 additions and 30 deletions

View file

@ -484,8 +484,7 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event)
if (event->buttons() == Qt::RightButton) { if (event->buttons() == Qt::RightButton) {
QWidget::mousePressEvent(event); QWidget::mousePressEvent(event);
return; return;
} } else if (event->buttons() == Qt::LeftButton) {
if (roomType_ == RoomType::Invited) { if (roomType_ == RoomType::Invited) {
const auto point = event->pos(); const auto point = event->pos();
@ -516,6 +515,7 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event)
ripple_overlay_->addRipple(ripple); ripple_overlay_->addRipple(ripple);
} }
}
void void
RoomInfoListItem::setAvatar(const QString &avatar_url) RoomInfoListItem::setAvatar(const QString &avatar_url)

View file

@ -45,8 +45,10 @@ RoomList::RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent)
scrollArea_->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); scrollArea_->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
scrollArea_->setWidgetResizable(true); scrollArea_->setWidgetResizable(true);
scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignTop | Qt::AlignVCenter); scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignTop | Qt::AlignVCenter);
scrollArea_->setAttribute(Qt::WA_AcceptTouchEvents);
QScroller::grabGesture(scrollArea_, QScroller::TouchGesture); QScroller::grabGesture(scrollArea_, QScroller::TouchGesture);
QScroller::grabGesture(scrollArea_, QScroller::LeftMouseButtonGesture);
// The scrollbar on macOS will hide itself when not active so it won't interfere // The scrollbar on macOS will hide itself when not active so it won't interfere
// with the content. // with the content.