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. Resize widgets when i resize the window

Resize widgets when i resize the window

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

    i have this :https://www.dropbox.com/s/1s6tm173kwy6l2g/screeshot.png
    I have 3 QTableView widgets, 2 scrollbars, one button and one line edit. How can i configure it so when i resize the window the widgets resize also?
    I have done a search and i as far as i undestand i have to add a layout. The problem is when i add a layout all the dimension of my widgets change and i can't change them back. What should i do?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      Hi!
      Layouts are right design. Can you show code how you add layouts?

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

        I think i don't quite undestand what do you mean. I don't write code for the layouts. I open my .ui file with the design and i try to add a layout by right click the top widget (in the box where it has object-layout) and then i press Lay Out and i choose one the listed options. (I use Qt5)

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qxoz
          wrote on last edited by
          #4

          Ok. Did you set layout for main window?

          !http://s23.postimg.org/5x31pddmz/layout.png(layout)!

          1 Reply Last reply
          0
          • S Offline
            S Offline
            salvador
            wrote on last edited by
            #5

            yes but i don't want the currrent widgets to be rearranged or the dimensions of the widgets change. Any of these option ruins the dimensions i have configure

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qxoz
              wrote on last edited by
              #6

              I am sorry but i cant understand your goals.
              you want "when i resize the window the widgets resize also" but you don't want "dimensions of the widgets change" . And what you mean by "rearranged" ? When you put them in to layout you set the arrange.

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

                I don't want the dimension to change when i add the layout. For example when i add the grid layout i get this :https://www.dropbox.com/s/01r9o9cv21phta5/screenshot2.png

                Of course when i resize the window i want the widgets to resize, that's why i want to add the layout to the widgets.

                Sorry if i am not explaining my problem, i am doing my best

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qxoz
                  wrote on last edited by
                  #8

                  In this case try play with sizePolicy of widgets. For example set sizePolicy->Vertical Policy = Expanding for left-bottom tableView and sizePolicy->Vertical Policy and Horizontal Policy = Expanding for rigth-bottom tableView.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    salvador
                    wrote on last edited by
                    #9

                    ok i'll try this. Thanks

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      prady_80
                      wrote on last edited by
                      #10

                      You can set the minimum dimensions of the widgets individually and then change the size policy. If these widgets have a layout associated with them, the on re-sizing the layout the widgets should automatically re-size. You can preview in the Qt-Designer and see if the functionality works as required by you.

                      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