Skip to content

Commit

Permalink
Use QScroller to provide primary mouse/touch input-based scrolling.
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaPosch committed Nov 10, 2021
1 parent de1d5f3 commit 132a333
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions player/NymphCastPlayer/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <QStandardPaths>
#include <QDir>
#include <QDataStream>
#include <QScroller>

#include "remotes.h"

Expand Down Expand Up @@ -210,6 +211,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainW
// Set values.
ui->sharesTreeView->setModel(&sharesModel);

// Set QScroller on the list view and similar that need touch-based scrolling support.
QScroller::grabGesture(ui->mediaListWidget, QScroller::LeftMouseButtonGesture);
QScroller::grabGesture(ui->sharesTreeView, QScroller::LeftMouseButtonGesture);

// Ensure this path exists.
QDir dir(appDataLocation);
if (!dir.exists()) {
Expand Down
15 changes: 13 additions & 2 deletions player/NymphCastPlayer/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,14 @@
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="mediaListWidget"/>
<widget class="QListWidget" name="mediaListWidget">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
</layout>
</item>
Expand Down Expand Up @@ -473,7 +480,11 @@
</widget>
</item>
<item>
<widget class="QTreeView" name="sharesTreeView"/>
<widget class="QTreeView" name="sharesTreeView">
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sharesPlayButton">
Expand Down

0 comments on commit 132a333

Please sign in to comment.