Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to load QTreeView asynchrone.

    General and Desktop
    2
    6
    156
    Loading More Posts
    • 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.
    • D
      developer_61 last edited by

      Hello,

      i want to load QTreeView asynchrone. So that the UI not freeze after I click on a Button and load the QTreeView.
      For now it is freeze and snychrone.

      Regards

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @developer_61 last edited by

        @developer_61 said in How to load QTreeView asynchrone.:

        For now it is freeze and snychrone

        Please provide more information, especially code where you load the tree. Also, how big is that tree when it's loaded?

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

        1 Reply Last reply Reply Quote 0
        • D
          developer_61 last edited by developer_61

          @jsulm
          i mean with freeze for that point where its loading. I want it asynchrone there.

          void MainWindow::loadQTree(const QString& string)
          {
             init(string); //here i'm using in this function an xml parse it etc. cause the tree is build of an xml
          }
          

          is there no standard to make it asynchronous?
          The files are like 28.000 Bytes big.

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @developer_61 last edited by

            @developer_61 said in How to load QTreeView asynchrone.:

            is there no standard to make it asynchronous?

            Use a thread for your XML parsing and send parsed data from that thread to the GUI thread to add it to the tree.
            But I'm wondering why parsing of 28kB XML would take that long? Can you show init()?

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

            1 Reply Last reply Reply Quote 0
            • D
              developer_61 last edited by

              @jsulm how to use that thread? and is it possible to do that during this loading with for example an small gear?
              no no it is not freezing long, really short time but I still want it to be asynchronous.

              jsulm 1 Reply Last reply Reply Quote 0
              • jsulm
                jsulm Lifetime Qt Champion @developer_61 last edited by

                @developer_61 said in How to load QTreeView asynchrone.:

                how to use that thread?

                Start here: https://doc.qt.io/qt-5/thread-basics.html
                "is it possible to do that during this loading with for example an small gear?" yes

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

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post