Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt file loading
Qt 6.11 is out! See what's new in the release blog

Qt file loading

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 682 Views 3 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.
  • A Offline
    A Offline
    aabb2137
    wrote on last edited by aabb2137
    #1

    QT 6.10.0 Windows
    Hi, I wanted to ask if in qt6 ssh connection changed somehow. It's much slower now I use ssh to connect to server and download files and in qt5 it was much faster.

    jsulmJ 1 Reply Last reply
    0
    • A aabb2137

      QT 6.10.0 Windows
      Hi, I wanted to ask if in qt6 ssh connection changed somehow. It's much slower now I use ssh to connect to server and download files and in qt5 it was much faster.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @aabb2137 What exactly do you mean? SSH connection in QtCreator?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aabb2137
        wrote on last edited by aabb2137
        #3

        @jsulm This is not about QtCreator’s SSH, but about SSH usage inside my application after migrating from Qt 5.15 to Qt 6.10 (Windows). My app connects to a server via SSH, scans remote directories, downloads files, and populates a QTreeWidget. With the same code, Qt 6 is significantly slower than Qt 5, and the app can crash if the file browser is closed while remote loading is still in progress.

        I now Qt6 is way stricter with threads etc than Qt5

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aabb2137
          wrote on last edited by aabb2137
          #4

          Okey maybe I found the fix. Runs the whole thing in a background thread. Not sure about this but it help the speed but I need to debug it more
          New version here, old one didn't use QtConcurrent

          if (ssh) {
          	   QPointer<FDirBrowser> guard(this);
          	   QtConcurrent::run([guard, ssh, subdir, url, currentDir, currentRow]{
          		// Code here
                          DirDownloadControlCallback ctrl;
          		FRemoteHost::DirNode dp = ssh->getDirListing(subdir, "*", config_DirDepth, &ctrl);
          		QMetaObject::invokeMethod(qApp, [guard, dp, subdir, url, currentDir, currentRow]{
          			if (!guard) return;
                          // Code here
          	   }, Qt::QueuedConnection);
            	});
          

          EDIT: Still it has some problems but is way faster

          1 Reply Last reply
          0
          • A Offline
            A Offline
            aabb2137
            wrote on last edited by
            #5

            OK, I found the real issue. I was calling processEvents() for every file during loading.
            As far as I understand, processEvents() was rewritten or made heavier in Qt 6, and it is significantly slower than it was in Qt 5.
            Reducing the calls to once every ~20 files (or batching them) improves performance a lot.

            jsulmJ 1 Reply Last reply
            0
            • A aabb2137

              OK, I found the real issue. I was calling processEvents() for every file during loading.
              As far as I understand, processEvents() was rewritten or made heavier in Qt 6, and it is significantly slower than it was in Qt 5.
              Reducing the calls to once every ~20 files (or batching them) improves performance a lot.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @aabb2137 You should avoid using processEvents. Instead make sure you do not block the event loop (for example by using threads for long running activities).

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • A Offline
                A Offline
                aabb2137
                wrote on last edited by aabb2137
                #7

                @jsulm In what situations should I use it then. I know it can create some problem, but are they times when its good to use it?

                SGaistS S 2 Replies Last reply
                0
                • A aabb2137

                  @jsulm In what situations should I use it then. I know it can create some problem, but are they times when its good to use it?

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @aabb2137 Hi,

                  Ideally, you avoid it.

                  This thread on the subject might interest you.

                  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
                  1
                  • A aabb2137

                    @jsulm In what situations should I use it then. I know it can create some problem, but are they times when its good to use it?

                    S Offline
                    S Offline
                    SimonSchroeder
                    wrote on last edited by
                    #9

                    @aabb2137 said in Qt file loading:

                    but are they times when its good to use it?

                    I don't think so. It is usually used as a quick workaround. However, you should rather restructure your code (usually using multi-threading) to avoid having to call processEvents. The most common place where this is used as a workaround is in loops to update the progress bar. The computation could be done a 100 times faster without calling processEvents.

                    Pl45m4P 1 Reply Last reply
                    0
                    • S SimonSchroeder

                      @aabb2137 said in Qt file loading:

                      but are they times when its good to use it?

                      I don't think so. It is usually used as a quick workaround. However, you should rather restructure your code (usually using multi-threading) to avoid having to call processEvents. The most common place where this is used as a workaround is in loops to update the progress bar. The computation could be done a 100 times faster without calling processEvents.

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by
                      #10

                      @SimonSchroeder said in Qt file loading:

                      The most common place where this is used as a workaround is in loops to update the progress bar

                      To be more precise: I think the only "valid" use case are splash screens with progress bars that show the initialization process of your app in main... There you don't have your app loop running and you might have some plain backend stuff going on.
                      Then you can call processEvents() to update your splash screen (when e.g. a separate QEventLoop is no option)


                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      1 Reply Last reply
                      2
                      • A Offline
                        A Offline
                        aabb2137
                        wrote last edited by
                        #11

                        Okey thank you all for your help!!

                        1 Reply Last reply
                        0
                        • A aabb2137 has marked this topic as solved

                        • Login

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