Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Resize widgets when i resize the window

    General and Desktop
    3
    10
    24486
    Loading More Posts
    • 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
      salvador last edited by

      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 Reply Quote 0
      • Q
        qxoz last edited by

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

        1 Reply Last reply Reply Quote 0
        • S
          salvador last edited by

          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 Reply Quote 0
          • Q
            qxoz last edited by

            Ok. Did you set layout for main window?

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

            1 Reply Last reply Reply Quote 0
            • S
              salvador last edited by

              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 Reply Quote 0
              • Q
                qxoz last edited by

                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 Reply Quote 0
                • S
                  salvador last edited by

                  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 Reply Quote 0
                  • Q
                    qxoz last edited by

                    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 Reply Quote 0
                    • S
                      salvador last edited by

                      ok i'll try this. Thanks

                      1 Reply Last reply Reply Quote 0
                      • P
                        prady_80 last edited by

                        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 Reply Quote 0
                        • First post
                          Last post