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. Not able to create my desired sizes and positions with QT Creator layouts
Forum Updated to NodeBB v4.3 + New Features

Not able to create my desired sizes and positions with QT Creator layouts

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

    Hello Everybody,

    I am designing my UI with ten buttons , a tree model, and two labels on a tab page of a Tab widget. I am not able to set the positions and sizes of my own if design them and set tab widget's layout otions. After creating them in my desired way I tried to set Layout->Layout in a GRID or any other style all the positions and sizes are being changed.

    Can somebody shed light on this ?

    Never Ever Give Up

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Could you give us a sketch of what you are trying to achieve?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KennedyDayala
        wrote on last edited by
        #3

        Helo Adre,

        is there any provision to send my image files ??

        Never Ever Give Up

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          No, you can not upload images to DevNet, but you can link to imaged uploaded elsewhere. You might look into using Dropbox.com, imagebin.org, or any other image sharing service you like.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            KennedyDayala
            wrote on last edited by
            #5

            hello Andre,
            Please have a look into my images...

            http://dl.dropbox.com/u/27922800/Changed design with TabWidget's GRID layout.png

            http://dl.dropbox.com/u/27922800/Desired Design before setting GRID layout.png

            Never Ever Give Up

            1 Reply Last reply
            0
            • W Offline
              W Offline
              wladek
              wrote on last edited by
              #6

              Can you please check the links since they are not working.

              Thanks.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sigrid
                wrote on last edited by
                #7

                If you want to hard code the size and positions of the buttons, then you can't use a layout on them. The job of the layout is to automatically arrange child widgets within a widget to ensure that they make good use of the available space, therefore you have to choose to either hard code sizes and positions yourself OR let the layout handle the layout and positioning for you.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  The images you posted are not publicly viewable, it seems. You need to put them in your public folder of your dropbox, and it is probably best to choose file names that don't have special characters (including spaces).

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    KennedyDayala
                    wrote on last edited by
                    #9

                    but if I hard code the sizes and positions they are not getting re aligned accordingly with main window's minimize and maximize actions...how can i handle this ?

                    Never Ever Give Up

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      Again: please show us what you want to achieve. That makes it much easier to help you out. If you want your layout to adjust with the resizing of the window, then you need layouts. The standard layouts however do have their limitations. These can sometimes be lifted by implementing your own layouts, but let's see what you are after before recommending such a thing.

                      In short: please fix URLS for the images you uploaded, so we can have a look.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        KennedyDayala
                        wrote on last edited by
                        #11

                        Desired:
                        !http://dl.dropbox.com/u/27922800/DesiredDesignBeforeSettingGRIDlayout.png(Desired design)!

                        After using layouts:
                        !http://dl.dropbox.com/u/27922800/ChangedDesignWithTabWidgetGRIDlayout.png(Result after using layouts)!

                        ..please lemme know if you could look into pics

                        Edit: inlined images in posting for easier viewing; Andre

                        Never Ever Give Up

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andre
                          wrote on last edited by
                          #12

                          Looks like the whole problem is, that your buttons get smaller, right?

                          So: why not give them a minimum size? You can do that in designer. Select the button, and modify the minimumSize property available in the QWidget group of properties.

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            ZapB
                            wrote on last edited by
                            #13

                            In fact if the buttons are themselves in a vertical layout then you only need to modify the minimum size of any one of the buttons. Just to save you some clicking ;-)

                            Nokia Certified Qt Specialist
                            Interested in hearing about Qt related work

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              KennedyDayala
                              wrote on last edited by
                              #14

                              buttons are getting small and other controls are getting large :-(

                              Never Ever Give Up

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andre
                                wrote on last edited by
                                #15

                                If you want them to keep relative sizes (not fixed), then you need to work with the horizontalStretch property of the sizePolicy. This allows you to set a ratio between the sizes of the areas.

                                I did sometimes notice that this seems to work best between as small a number of widgets as possible. If it doesn't work if you set them directly, try putting your buttons in a QWidget as a container, and your two views too, layout these containers horizontally and set their stretch factors, and then layout the views and the buttons within their respective QWidget containers.

                                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