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. Show the same Widget at different places
QtWS25 Last Chance

Show the same Widget at different places

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 3.3k 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.
  • T Offline
    T Offline
    thiberi0
    wrote on last edited by
    #1

    Hello all,
    I am trying to archive the following:
    http://postimg.org/image/z96gmotdh/

    Every time that the user clicks in some item from "Basin Model" a different widget("Property Widget") should be shown at the bottom left place:
    http://postimg.org/image/wx2xsagyn/

    However should be also possible to the user edit the "Property Widget" clicking in some action("Edit action"), as shown:
    http://postimg.org/image/z96gmotdh/

    The problem is that I have to able to shown both at same time and any change in one widget have to be implemented at the other, since both represents the same "Property Widget". There any tricky to do this? or any example in how to do this? or any book that gives some hints?

    thiberi0

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msue
      wrote on last edited by
      #2

      You probably have the data that are shown at the two places separated from the two widgets (or widget instances) that show it.
      Then, if you change the data in one widget the data can send a signal that they have just changed and the other widget would re-act in a slot re-initializing itself with the changed data and v.v.

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        Since you can't have the same widget be shown twice (QObject class can't be copied) and the widgets do have a parent class (MainWindow?) it is as msue says, use a signal/slot connection between them. An update from the one will trigger an update to the other. If the widgets use a 'base' set of values you could create a dataclass and use that in the signal/slot (use Q_DECLARE_METATYPE) connection as an argument to transport the data from one class to the other.
        If the widgets update setting in the Mainwindow class, you could use the MainWindow (parent) class as a collector/distribute connection between the widgets, but to avoid that the MainWindow gets bulky I would recommend the first option.

        Greetz, Jeroen

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          As an experiment, you could use QGraphicsView with several viewports, but the suggestions posted by msue and Jeroentje are probably better.

          (Z(:^

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

            Hi,

            To add to the suggestions, depending on your data, the Model/View paradigm might also be an interesting alternative

            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

            • Login

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