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. update only active qwidgets
Qt 6.11 is out! See what's new in the release blog

update only active qwidgets

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 520 Views
  • 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.
  • J Offline
    J Offline
    Jakob Clausen
    wrote on last edited by
    #1

    Hi.

    This is probably pretty basic, but I cannot find anything on this.

    I have a lot of widgets, which are all set or read by a central datacenter. How do I do that best?
    Do I need a signal/slot for each data item or should I have a getData()/setData() method in my datahandler.

    The widgets are on different screens, so I only need to update the ones, the user can actually see. Should I build a mechanism to tell the widgets, that they can now be seen and now have to update themselves from the datacenter or is there a clever way to disable slots that are out of view?

    JonBJ 1 Reply Last reply
    0
    • J Jakob Clausen

      Hi.

      This is probably pretty basic, but I cannot find anything on this.

      I have a lot of widgets, which are all set or read by a central datacenter. How do I do that best?
      Do I need a signal/slot for each data item or should I have a getData()/setData() method in my datahandler.

      The widgets are on different screens, so I only need to update the ones, the user can actually see. Should I build a mechanism to tell the widgets, that they can now be seen and now have to update themselves from the datacenter or is there a clever way to disable slots that are out of view?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Jakob-Clausen
      This a pretty generic question, so i will just make a couple of observations.

      Qt slots cannot return a value. Therefore at minimum they are not suitable for a get-type function. So getters & setters are the usual way to access values.

      I don't know exactly what you mean by "out of view". But there is nothing to stop you still getting/setting widget values which are not visible for whatever reason. It's not a terribly expensive operation (assuming you are just getting/setting an existing widget's value).

      If you have a lot of widgets you might like to take a look at QDataWidgetMapper. This uses a model to achieve a two-way, getter-setter mapping between each widget and a single data item. You have to write code to map between a Qt model and whatever your "datacenter" presents as its data.

      1 Reply Last reply
      2
      • J Offline
        J Offline
        Jakob Clausen
        wrote on last edited by
        #3

        Ok. I'll have a look at that.
        Thank you very much.

        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