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. Access gui elements of other classes
Qt 6.11 is out! See what's new in the release blog

Access gui elements of other classes

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k 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
    derdiek
    wrote on last edited by
    #1

    Hello,
    My situation is the following:

    I have a dll lib that contains a MainWindow and about 10 programs that are derived from this MainWindow to add specific toolbars etc. So the general layout (menubar, toolbar on top) is the same for every program.

    I want to create a class that is able to access GUI-elements of the MainWindow and the derived classes at the same time. How is this possible?

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

      Hi,
      There is about only one way to do that, make your GUI elements public, but you should NEVER EVER DO THAT!! The only safe way is to use setters/getters.
      Gr

      Greetz, Jeroen

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rahul Das
        wrote on last edited by
        #3

        What about your GUI-Controller class emit some signal, and your Window classes are connected to it ?

        Or,

        try the meta object way : http://qt-project.org/doc/qt-5.0/qtcore/qmetaobject.html#invokeMethod


        Declaration of (Platform) independence.

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

          So, in basic setter/getter functions using signal/slots or meta objects.

          Greetz, Jeroen

          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