Quick hack to enable touch scrolling in settings and room list

This commit is contained in:
Nicolas Werner 2020-02-15 03:47:58 +01:00
parent ef5edbb3ea
commit 70f4a89d10
2 changed files with 6 additions and 0 deletions

View file

@ -19,6 +19,7 @@
#include <QObject> #include <QObject>
#include <QPainter> #include <QPainter>
#include <QScroller>
#include <QTimer> #include <QTimer>
#include "Logging.h" #include "Logging.h"
@ -41,6 +42,8 @@ RoomList::RoomList(QWidget *parent)
scrollArea_->setWidgetResizable(true); scrollArea_->setWidgetResizable(true);
scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignTop | Qt::AlignVCenter); scrollArea_->setAlignment(Qt::AlignLeading | Qt::AlignTop | Qt::AlignVCenter);
QScroller::grabGesture(scrollArea_, QScroller::TouchGesture);
// 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.
#if not defined(Q_OS_MAC) #if not defined(Q_OS_MAC)

View file

@ -27,6 +27,7 @@
#include <QPushButton> #include <QPushButton>
#include <QResizeEvent> #include <QResizeEvent>
#include <QScrollArea> #include <QScrollArea>
#include <QScroller>
#include <QSettings> #include <QSettings>
#include <QStandardPaths> #include <QStandardPaths>
#include <QString> #include <QString>
@ -398,6 +399,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
scrollArea_->setWidgetResizable(true); scrollArea_->setWidgetResizable(true);
scrollArea_->setAlignment(Qt::AlignTop | Qt::AlignVCenter); scrollArea_->setAlignment(Qt::AlignTop | Qt::AlignVCenter);
QScroller::grabGesture(scrollArea_, QScroller::TouchGesture);
auto scrollAreaContents_ = new QWidget(this); auto scrollAreaContents_ = new QWidget(this);
scrollAreaContents_->setObjectName("UserSettingScrollWidget"); scrollAreaContents_->setObjectName("UserSettingScrollWidget");
scrollAreaContents_->setLayout(mainLayout_); scrollAreaContents_->setLayout(mainLayout_);