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. setContextProperty takes very long and blocks UI
Forum Updated to NodeBB v4.3 + New Features

setContextProperty takes very long and blocks UI

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 858 Views 2 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.
  • R Offline
    R Offline
    RudolfVonKrugstein
    wrote on last edited by
    #1

    Hey,

    I am calling "setContextProperty" with a bigger data structure. It is not extremely big (A list with about 100 entries), but it takes several seconds until the call finished.

    AND because I have to do that in the main thread, the complete UI is blocked in that time. So what can I do?

    Thanks!

    1 Reply Last reply
    0
    • R Offline
      R Offline
      RudolfVonKrugstein
      wrote on last edited by
      #2

      Hey,

      I discovered: It is not setting the data itself. It is the UI structure, that displays the data that takes so long. So I tried disabling the UI Display (It is a ListView) by setting its model to [] while I am loading. But now, re-enabling the UI Display takes long.

      What can I do?

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

        Hi,

        What kind of list is ?

        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
        • R Offline
          R Offline
          RudolfVonKrugstein
          wrote on last edited by
          #4

          It is a list of QObjects, which themself each contain a list of QObjects. But I found the error!

          The code was like this (pseudo code):

          ListView {
              model: cppData
              delegate: ListView {
                  model: innerData
                  delegate: Item {
                       Rectangle {...}
                       DropShadow {
                           ...
                          visible: isActiveObject
                      }
                  }
              }
          }
          

          So I was creating a lot of DropShadows. Also only one was visible, that was the problem. Removing the DropShadows solved it.

          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