Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PYQT5 - Populating Model from Thread / Sorting large Tree advice
Forum Updated to NodeBB v4.3 + New Features

PYQT5 - Populating Model from Thread / Sorting large Tree advice

Scheduled Pinned Locked Moved Unsolved Language Bindings
4 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kelv1n
    wrote on last edited by
    #1

    Hi All

    I'm learning PyQT5, so I've set myself the challenge of building a "TreeSize" replica (the famous Windows app for identifying disk usage). I've got a non-threaded version working, recursing the filesystem and populating a QTreeWidget, but its slow and freezes the UI when scanning and sorting (due to the volume of Items).

    So I'm looking for example code or advice on the following:

    • Populating a model large amounts of data that is being generated from a separate QThread.

    • Sorting the model / tree without it freezing the OS

    I've very much appreciate any help to point me in the right direction.. I did ask a similar question elsewhere, and they said QFileSystemModel was threaded, but I can't see it or I think they were referring to the C++ version!

    Many thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      They were right, QFileSystemModel is indeed threaded. Note that all PyQt 5 classes are wrappers around Qt's C++ classes.

      What is usually done when having lots of data is to process them by batch so that you don't overload your main thread.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        They were right, QFileSystemModel is indeed threaded. Note that all PyQt 5 classes are wrappers around Qt's C++ classes.

        What is usually done when having lots of data is to process them by batch so that you don't overload your main thread.

        K Offline
        K Offline
        Kelv1n
        wrote on last edited by
        #3

        @SGaist so is the threading in "QFileSystemModel" (The Python wrapper) done in the Python code or inside the QT library? I'm looking for some example code to show an approach this, I've got a few ideas, but probably not very workable.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          PyQt is a wrapper on top of Qt, what happens within the Qt classes is on the C++ side.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved