Qt Forum

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

    Layout Horizontally

    General and Desktop
    7
    13
    5915
    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
      szh1 last edited by

      I have a QMainWindow with 2 QTreeViews, next to each other horizontally. The one on the left is smaller than the one on the right. But when I choose Layout Horizontally, they automatically become equal sizes. How can I keep the one on the right bigger than the one on the left?

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

        I think that YourTreeView->setMaximumSize could help you with what you want

        There are only 10 types of people in the world: Those who understand binary, and those who don't

        1 Reply Last reply Reply Quote 0
        • D
          DenisKormalev last edited by

          Try to use horizontalStretch

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

            Thanks for the answers. Sorin's answer works if you want one of the QTreeViews not to get bigger than a certain size (like in my case). Denis Kormalev's answer is good if you want to keep them proportionate to each other.

            Thanks!

            1 Reply Last reply Reply Quote 0
            • M
              MTK358 last edited by

              Or you can use a splitter and let the user choose the relative sizes of the tree views.

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

                Good idea

                1 Reply Last reply Reply Quote 0
                • T
                  TigerTony last edited by

                  Hi.
                  My situation is exactly the same and i like to use QSplitter in this scenario.

                  But HOW do i achieve this with QDesigner???

                  In the "Layout" submenue of the context menu of QMainWindow in the object view, the two optiones with splitter are grey/inactive - in the toolbar, too. wtf?

                  How can i actually use them?

                  And yes, there is one widget inside "centralwidget" - two widgets dont help either.

                  Thanks
                  L.

                  PS: Using QDesigner 4.7.0 on Windows.

                  1 Reply Last reply Reply Quote 0
                  • G
                    giesbert last edited by

                    The splitter itself is a widget.

                    SO select the widgets you want to use in the splitter, layout them by the splitter and put a V or HBoxLayout on the main window.
                    Or use the splitter as central widget.

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply Reply Quote 0
                    • T
                      TigerTony last edited by

                      Hi Gerolf.
                      Thanks for your answer.

                      But in my opionion you missed the point. Sorry. But i forgot to mention, there is no Splitter widget in QDesigner wigdet toolbox!

                      The question remains, how do i do this with QDesigner 4.7.0 ?

                      Or do i just dont get it?

                      Thanks
                      Lars

                      1 Reply Last reply Reply Quote 0
                      • G
                        goetz last edited by

                        Got the "Form" menu and select "Lay Out Horizontally in a Splitter".

                        And read "this":http://doc.qt.nokia.com/4.7/designer-quick-start.html, "this":http://doc.qt.nokia.com/4.7/designer-layouts.html and "this":http://doc.qt.nokia.com/4.7/designer-manual.html

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

                        1 Reply Last reply Reply Quote 0
                        • T
                          TigerTony last edited by

                          Ok, got it now.

                          I didnt know that i actually need two "layouts" in the right order. (Though the splitter is no real layout, i know).

                          First the splitter "layout" on the two wigdets. Then the layout of the main window (for dynamic resizing of the widgets).

                          A always applied the layout of the main window first, but then your stuck. And there is no splitter option in the first place.

                          Thanks a lot.

                          1 Reply Last reply Reply Quote 0
                          • G
                            goetz last edited by

                            Nice, that it works now.

                            You're right, the order of layouts is important, but easy to memorize: Always layout from the inner pieces to the outer, single widgets to groups, groups to bigger groups and the toplevel layout at the very end.

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

                            1 Reply Last reply Reply Quote 0
                            • T
                              TigerTony last edited by

                              And now Gerolfs post makes sense to me.

                              Sorry.

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post