Skip to content
Snippets Groups Projects
Commit b8ce9d54 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix scrolling the room list using touch

parent 97688763
No related branches found
No related tags found
No related merge requests found
Pipeline #209 passed
...@@ -484,37 +484,37 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event) ...@@ -484,37 +484,37 @@ 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();
if (acceptBtnRegion_.contains(point)) if (acceptBtnRegion_.contains(point))
emit acceptInvite(roomId_); emit acceptInvite(roomId_);
if (declineBtnRegion_.contains(point)) if (declineBtnRegion_.contains(point))
emit declineInvite(roomId_); emit declineInvite(roomId_);
return; return;
} }
emit clicked(roomId_); emit clicked(roomId_);
setPressedState(true); setPressedState(true);
// Ripple on mouse position by default. // Ripple on mouse position by default.
QPoint pos = event->pos(); QPoint pos = event->pos();
qreal radiusEndValue = static_cast<qreal>(width()) / 3; qreal radiusEndValue = static_cast<qreal>(width()) / 3;
Ripple *ripple = new Ripple(pos); Ripple *ripple = new Ripple(pos);
ripple->setRadiusEndValue(radiusEndValue); ripple->setRadiusEndValue(radiusEndValue);
ripple->setOpacityStartValue(0.15); ripple->setOpacityStartValue(0.15);
ripple->setColor(QColor("white")); ripple->setColor(QColor("white"));
ripple->radiusAnimation()->setDuration(200); ripple->radiusAnimation()->setDuration(200);
ripple->opacityAnimation()->setDuration(400); ripple->opacityAnimation()->setDuration(400);
ripple_overlay_->addRipple(ripple); ripple_overlay_->addRipple(ripple);
}
} }
void void
......
...@@ -45,8 +45,10 @@ RoomList::RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent) ...@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment