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. I could use some guidelines on layouts
Forum Updated to NodeBB v4.3 + New Features

I could use some guidelines on layouts

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

    Hi -

    I'm to the point in my (first) Qt project where I actually care about the appearance of the UI (!) so it's time for me to become more familiar with layouts. I read a few of the pages on them, but I'd like some input from the mavens here.

    1. When a widget is placed into a layout, many of its properties are locked. So, do I correctly gather that the right development workflow is to get your widgets the way you want them, then finally add them? This seems a little inconvenient, as you don't really know what something's going to look like until you put it in a layout. How does one minimize the number of times you put something into a layout, then break the layout to modify the widget to look right?

    2. I read that layouts can contain other layouts. Should there be a master layout for the entire app, or is it better practice to adhere to a 1:1 window:master-layout pattern?

    3. does anyone know of a good reference for best practices? Now that I'm actually getting started on this, I'd like to avoid bad habits up front.

    I realize that there aren't really definitive answers to these questions, but I've always learned from other people's input in these forums. Thanks.

    mrjjM 1 Reply Last reply
    0
    • mzimmersM mzimmers

      Hi -

      I'm to the point in my (first) Qt project where I actually care about the appearance of the UI (!) so it's time for me to become more familiar with layouts. I read a few of the pages on them, but I'd like some input from the mavens here.

      1. When a widget is placed into a layout, many of its properties are locked. So, do I correctly gather that the right development workflow is to get your widgets the way you want them, then finally add them? This seems a little inconvenient, as you don't really know what something's going to look like until you put it in a layout. How does one minimize the number of times you put something into a layout, then break the layout to modify the widget to look right?

      2. I read that layouts can contain other layouts. Should there be a master layout for the entire app, or is it better practice to adhere to a 1:1 window:master-layout pattern?

      3. does anyone know of a good reference for best practices? Now that I'm actually getting started on this, I'd like to avoid bad habits up front.

      I realize that there aren't really definitive answers to these questions, but I've always learned from other people's input in these forums. Thanks.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mzimmers

      Hi

      1:
      Which one do you mean ? The geometry of the widget is controlled by the layout.
      Other than that any property can still be set?
      After you insert widget into a layout u control how big it gets by min/max values and
      a policy about if it should take all space or stay as small as possible etc.

      2:
      Im not sure what a master layout would be.
      You might use nested layouts when you need the an item that stack the other way or
      a multi section widget.

      3:
      Best Pratice i can think of is use them from start. Design with them from start.
      its hard to fix up later. And they are needed for correct scaling on different screen.

      mzimmersM 1 Reply Last reply
      0
      • mrjjM mrjj

        @mzimmers

        Hi

        1:
        Which one do you mean ? The geometry of the widget is controlled by the layout.
        Other than that any property can still be set?
        After you insert widget into a layout u control how big it gets by min/max values and
        a policy about if it should take all space or stay as small as possible etc.

        2:
        Im not sure what a master layout would be.
        You might use nested layouts when you need the an item that stack the other way or
        a multi section widget.

        3:
        Best Pratice i can think of is use them from start. Design with them from start.
        its hard to fix up later. And they are needed for correct scaling on different screen.

        mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by mzimmers
        #3

        @mrjj

        1. from the layout page:

        All QWidget subclasses can use layouts to manage their children. The QWidget::setLayout() function applies a layout to a widget. When a layout is set on a widget in this way, it takes charge of the following tasks:

        Positioning of child widgets.
        Sensible default sizes for windows.
        Sensible minimum sizes for windows.
        Resize handling.
        Automatic updates when contents change:
        Font size, text or other contents of child widgets.
        Hiding or showing a child widget.
        Removal of child widgets.

        I also notice that I'm unable to resize widgets in design mode when the widgets are in a layout.
        2. by "master layout" what I mean was one layout for the entire application (no matter how many displays it may have), within which are subordinate layouts for each window. I'm pretty sure you can do this; I'm more interested in whether one should do it.
        3. Thank you. I intend to use them. As I mentioned, I want to do this the right way the first time. I just don't entirely know what the right way is.

        mrjjM 1 Reply Last reply
        0
        • mzimmersM mzimmers

          @mrjj

          1. from the layout page:

          All QWidget subclasses can use layouts to manage their children. The QWidget::setLayout() function applies a layout to a widget. When a layout is set on a widget in this way, it takes charge of the following tasks:

          Positioning of child widgets.
          Sensible default sizes for windows.
          Sensible minimum sizes for windows.
          Resize handling.
          Automatic updates when contents change:
          Font size, text or other contents of child widgets.
          Hiding or showing a child widget.
          Removal of child widgets.

          I also notice that I'm unable to resize widgets in design mode when the widgets are in a layout.
          2. by "master layout" what I mean was one layout for the entire application (no matter how many displays it may have), within which are subordinate layouts for each window. I'm pretty sure you can do this; I'm more interested in whether one should do it.
          3. Thank you. I intend to use them. As I mentioned, I want to do this the right way the first time. I just don't entirely know what the right way is.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @mzimmers said in I could use some guidelines on layouts:

          Well you can still change font type etc. byt yes, x,y is locked.

          I also notice that I'm unable to resize widgets in design mode when the widgets are in a layout.

          You set minimum size or max size to express such wishes. you can also set fixed size to not let it
          take more space. So you can change size but its other way than when not in layout.

          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