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. Qt Designer Master Layout for Dialog/Mainscreen/etc
Forum Updated to NodeBB v4.3 + New Features

Qt Designer Master Layout for Dialog/Mainscreen/etc

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.4k 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.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by Crag_Hack
    #1

    Hi I was wondering if it is possible to access the master layout used in Qt Designer for a widget. When you create a dialog or mainscreen or whatever in Qt Designer you can right click on the main widget and select Lay Out --> then choose how you want to lay out all the children widgets in the main widget. However when you look at the Object Inspector (the list of all widgets and layouts for the current dialog/mainscreen/etc) there is no entry for the layout you just created by right clicking and choosing layout. I couldn't find any way to access this main grid layout from my code using ui->mastergridlayout->setcolumnstretch or something similar. Is it possible to do so?

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

      Hi,

      It depends partly on what widget you are currently designing. QMainWindow has a custom layout that makes its magic work unlike Widget where you have to first set a layout on it.

      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
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        Thanks SGaist ... so for me I have a QDialog in Designer where I performed the previously mentioned method of laying out by right clicking and setting the layout; can I access this master layout using ui->***** or is this not possible? I'm trying to have the right side of the master gridlayout greedy for extra space when resizing.

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

          Widgets have the layout method that you can use to retrieve it then you can use qobject_cast to cast it to a QGridLayout.

          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
          1
          • C Offline
            C Offline
            Crag_Hack
            wrote on last edited by
            #5

            Thanks again. What got me was I forgot to cast the QLayout to QGridLayout and therefore couldn't access the methods I needed to.

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

              You're welcome !

              Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution have been found :)

              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