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. Problem Updating display when Data has changed

Problem Updating display when Data has changed

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 921 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.
  • D Offline
    D Offline
    dhlii
    wrote on last edited by
    #1

    I have a Qt GUI in a program that is asynchronously receiving data from an external source.

    I need to persuade the GUI to update the display when the data that it is showing may have changed.

    There are many screens to the GUI and some values are displayed on multiple screens, some of the objects being displayed are static but most are created dynamically, and there are often several instances of the same object that differ only in the data that they display.

    What is the Qt Mechanism to force Qt to redraw the entire display ?
    The code that displayed the screen in the first place properly retreives values from where they are stored, but it does not know that it needs to do so again.

    I expect this is a simple problem and my difficulty reflects a poor understanding of Qt. I am not primarily a GUI developer - this is an embedded laser controller project and my primary role is the code communicating with the laser.

    Thank you

    jsulmJ 1 Reply Last reply
    0
    • D dhlii

      I have a Qt GUI in a program that is asynchronously receiving data from an external source.

      I need to persuade the GUI to update the display when the data that it is showing may have changed.

      There are many screens to the GUI and some values are displayed on multiple screens, some of the objects being displayed are static but most are created dynamically, and there are often several instances of the same object that differ only in the data that they display.

      What is the Qt Mechanism to force Qt to redraw the entire display ?
      The code that displayed the screen in the first place properly retreives values from where they are stored, but it does not know that it needs to do so again.

      I expect this is a simple problem and my difficulty reflects a poor understanding of Qt. I am not primarily a GUI developer - this is an embedded laser controller project and my primary role is the code communicating with the laser.

      Thank you

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

      @dhlii said in Problem Updating display when Data has changed:

      What is the Qt Mechanism to force Qt to redraw the entire display ?

      There is no need to force redraw. Just change the content of affected widgets and they will redraw.

      "The code that displayed the screen in the first place properly retreives values from where they are stored, but it does not know that it needs to do so again." - how do they retrieve the values? Usually, in Qt, you use signals and slots. The component responsible for data is emitting signals when new data arrives or existing data changes. And UI components connect their slots to that signals and update the UI as needed.

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

      1 Reply Last reply
      3
      • D Offline
        D Offline
        dhlii
        wrote on last edited by
        #3

        That data is not in the object, When the object is "repainted" it retreives the data.

        Unless I misunderstand Signals and Slots are 1:1, to do something like Signals and Slots I need 1:many. There could be more than one object that "receives" the changed data.

        I tried to use customEvents, but the "event" needs to hit every currently displayed object. If there is a way to do that - I have not figured it out.

        I can not beleive this is difficult in Qt as the problem is fairly common, pretty much any real world device that receives and displays asynchronously sent data from some external device would have to do something similar.

        jsulmJ 1 Reply Last reply
        0
        • D dhlii

          That data is not in the object, When the object is "repainted" it retreives the data.

          Unless I misunderstand Signals and Slots are 1:1, to do something like Signals and Slots I need 1:many. There could be more than one object that "receives" the changed data.

          I tried to use customEvents, but the "event" needs to hit every currently displayed object. If there is a way to do that - I have not figured it out.

          I can not beleive this is difficult in Qt as the problem is fairly common, pretty much any real world device that receives and displays asynchronously sent data from some external device would have to do something similar.

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

          @dhlii said in Problem Updating display when Data has changed:

          Unless I misunderstand Signals and Slots are 1:1

          You do. You can connect a signal to as many slots as you like.
          "I can not beleive this is difficult in Qt" - I don't see what is difficult about it, in Qt it is done using signals/slots as I said...

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

          1 Reply Last reply
          1

          • Login

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