Search code examples
qtuser-interfacepyqt4qt-designerqtgui

How can I allow user resize on elements within the window using Qt designer?


I want to allow a user using my application to be able to drag a boundary between two widgets in my window which will resize the two (i.e. you drag it down and the top one will get bigger while the bottom gets smaller, and vice-versa).

Is there anything in Qt designer that will allow a user to resize an element in the window, within certain constraints?

Thank you


Solution

  • What you're describing is called a QSplitter widget. In Qt Designer, you can create one by selecting 2 or more widgets, and then clicking the splitter button on the toolbar at the top. It's in the same location as the layout buttons. It will place those widgets inside a QSplitter. You still need to place the splitter widget inside another layout. It will create a handle between them to let you resize the portion that each widget gets.

    enter image description here