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. Spacers and Layouts
QtWS25 Last Chance

Spacers and Layouts

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

    I have just started out Qt from the book "C++ GUI programming with Qt4". I have some basic doubts 1.) What is the role/purpose of Spacers in designing the layouts? 2.) In the SortDialog prorgam, thelayout()->setSizeConstraint(QLayout::SetFixedSize); gives me a segmentation fault. I am not able to solve the problem. Without this line, the code works perfectly. 3.) What is a Top Level Layout? pls help...thnx

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2
      1. Spacers
        In short words: These keep things apart that would otherwise be glued together by the layout. I'd suggest you play around with Qt Designer - you will have immediate visual feedback. It's very easy to understand then.

      2. Segfault
        Hard to comment without the source code. But a segfault is almost always on a null pointer, so it is very likely that you forgot to set the layout. Also, is "thelayout()" really a method?

      3. Toplevel Layouts
        This is the layout that is applied to the widget. You will almost always have some further layouts, that are included in the toplevel layout.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saurabhsood
        wrote on last edited by
        #3

        thnx for the reply...
        thelayout was a typo. it should be layout()->.....
        does setting the layout in Qt Designer mean i just have to lay out the widgets in a specified order, like Lay out Horizontally / Vertically ? . Does setting this mean setting a Top Level Layout.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          Layout are designed to automatically forming objects positions when resizing the form or its parent.

          [quote author="saurabhsood" date="1294852671"]thnx for the reply...
          thelayout was a typo. it should be layout()->.....
          does setting the layout in Qt Designer mean i just have to lay out the widgets in a specified order, like Lay out Horizontally / Vertically ? . Does setting this mean setting a Top Level Layout. [/quote]

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            [quote author="saurabhsood" date="1294852671"]thnx for the reply...
            thelayout was a typo. it should be layout()->.....
            does setting the layout in Qt Designer mean i just have to lay out the widgets in a specified order, like Lay out Horizontally / Vertically ? . Does setting this mean setting a Top Level Layout. [/quote]

            Did you read the Qt docs on layouts already?

            • "Layout Management":http://doc.qt.nokia.com/4.7-snapshot/layout.html
            • "Widgets and Layouts":http://doc.qt.nokia.com/4.7-snapshot/widgets-and-layouts.html#layouts
            • "Widgets Tutorial - Using Layouts":http://doc.qt.nokia.com/4.7-snapshot/tutorials-widgets-windowlayout.html
            • "Widgets Tutorial - Nested Layouts":http://doc.qt.nokia.com/4.7-snapshot/tutorials-widgets-nestedlayouts.html
            • "A Quick Start to Qt Designer":http://doc.qt.nokia.com/4.7-snapshot/designer-quick-start.html
            • "Layout Examples":http://doc.qt.nokia.com/4.7-snapshot/examples-layouts.html

            http://www.catb.org/~esr/faqs/smart-questions.html

            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