Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCManFM-Qt: Smooth Scrolling Adds Noticeable Delays to Detailed List Mode #739

Closed
Chiitoo opened this issue Oct 20, 2021 · 5 comments · Fixed by #740
Closed

PCManFM-Qt: Smooth Scrolling Adds Noticeable Delays to Detailed List Mode #739

Chiitoo opened this issue Oct 20, 2021 · 5 comments · Fixed by #740
Assignees
Labels

Comments

@Chiitoo
Copy link
Contributor

Chiitoo commented Oct 20, 2021

Expected Behavior

Less delay in moving to a directory or when re-sorting files in PCManFM-Qt.

Current Behavior

After 363233e [1], smooth scrolling is enabled for PCManFM-Qt's Detailed List view, and this seems to add a noticeable delay to opening and/or re-sorting files.

The delay will probably only become longer with more files, starting to be very noticeable with approximately 5000 files on my system (Ryzen 7 1700, tested with SSDs and HDDs), becoming around one second with about 10000 files.

  1. 363233e
Possible Solution

At the very least it would be nice to have the option to disable smooth scrolling in Preferences (personally I might still prefer the non-smooth scroll regardless of this issue).

Steps to Reproduce (for bugs)

My current builds use the Qt upstream 5.15 git master branch, with the KDE patches applied on top. I have not tested this with any official releases of Qt.

  1. Create, or/and open a directory with 10000 files or more.
  2. Click file name, type, size, modified, or any other columns to sort files.
  3. Notice that the delay in both, opening the directory and sorting takes quite a bit longer than without the smooth scrolling commit.
Context

This seems to affect me surprisingly often, and albeit the delay usually is only around 1 second, it's not exactly fun either. :]

System Information
  • Distribution & Version: Gentoo Linux
  • Kernel: Linux 5.14.11
  • Qt Version: 5.15.2 With KDE Patches
  • libqtxdg Version: git master (dcac08a0331)
  • lxqt-build-tools Version: git master (426067cf026)
  • Package version: git master (3470b20)
@tsujan
Copy link
Member

tsujan commented Oct 20, 2021

First, thanks for the report!

The code of smooth scrolling has nothing to do with sorting. This Qt method is the cause:

setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

I tested with ~/.cache/thumbnails/normal, which contains 55,131 files here. I did 2 tests, one with KDE file dialog and the other with LXQt file dialog, both in the list mode and on HDD:

  • KDE file dialog took a very long time to completely load that folder each time. After the folder was loaded, I changed the sorting. It took a little more than 1 second. That's while KDE file dialog doesn't support smooth scrolling in its list mode.
  • LXQt file dialog took a while to open the directory the first time (see First loading of heavy folders takes a lot of time on HDD pcmanfm-qt#462) but not only it was faster than KDE file dialog but also loading was much faster later. Changing of sorting took about 2 seconds.

So, I'm afraid it's a problem in QAbstractItemView::setVerticalScrollMode(). IMHO, it's quite tolerable because, after all, it happens only under rare circumstances and isn't disastrous.

@tsujan tsujan added the Qt bug label Oct 20, 2021
@tsujan
Copy link
Member

tsujan commented Oct 20, 2021

As a workaround, adding options to pcmanfm-qt and LXQt file dialog for disabling smooth scrolling in detailed and compact modes seems acceptable to me because it'll be only about using or not using QAbstractItemView::ScrollPerPixel — the rest doesn't affect this.

QAbstractItemView::ScrollPerPixel is used by default for icon/thumbnail view. So, nothing has been changed in their case.

I'll work on it.

@tsujan tsujan self-assigned this Oct 20, 2021
tsujan added a commit that referenced this issue Oct 20, 2021
It appears only with list and compact modes. By default, smooth scrolling is enabled.

The reason behind this option is that Qt may slow down item sorting when the number of items is huge and scrolling is done per pixel in list or compact mode. As a workaround, the user can disable per-pixel scrolling by disabling smooth scrolling.

Closes #739

WARNING: All libfm-qt based apps should be recompiled.
@tsujan
Copy link
Member

tsujan commented Oct 20, 2021

@Chiitoo
Could you test #740 with LXQt file dialog? pcmanfm-qt (and other libfm-qt based apps) should be recompiled after applying the patch.

If everything is OK, I'll add an option to pcmanfm-qt too.

@Chiitoo
Copy link
Contributor Author

Chiitoo commented Oct 20, 2021

Seems to work as advertised.

Most excellent, thank you!

@tsujan
Copy link
Member

tsujan commented Oct 20, 2021

Thanks for the fast reply!

Tomorrow, I'll read the patch again. If I find nothing suspicious, I'll merge it and add an option to pcmanfm-qt.

tsujan added a commit that referenced this issue Oct 21, 2021
It appears only with list and compact modes. By default, smooth scrolling is enabled.

The reason behind this option is that Qt may slow down item sorting when the number of items is huge and scrolling is done per pixel in list or compact mode. As a workaround, the user can disable per-pixel scrolling by disabling smooth scrolling.

Closes #739

WARNING: All libfm-qt based apps should be recompiled.
tsujan added a commit to lxqt/pcmanfm-qt that referenced this issue Oct 21, 2021
The reason is that Qt may slow down item sorting in the list and compact modes when the number of items is huge and scrolling is done per pixel (smooth scrolling itself isn't the cause of slowdown; see lxqt/libfm-qt#739 (comment)). As a workaround, the user can disable per-pixel scrolling by disabling smooth scrolling in those modes, although that isn't needed in most use cases.
tsujan added a commit to lxqt/pcmanfm-qt that referenced this issue Oct 21, 2021
…1466)

The reason is that Qt may slow down item sorting in the list and compact modes when the number of items is huge and scrolling is done per pixel (smooth scrolling itself isn't the cause of slowdown; see lxqt/libfm-qt#739 (comment)). As a workaround, the user can disable per-pixel scrolling by disabling smooth scrolling in those modes, although that isn't needed in most use cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants