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

前端 未结 2 397
故里飘歌
故里飘歌 2021-01-12 18:12

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 w

相关标签:
2条回答
  • 2021-01-12 18:33

    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.

    0 讨论(0)
  • 2021-01-12 18:34

    You're looking for the QDockWidget. It can do all that you described above and more. The user can dock the widget to different sides of the window, changing which widget is on the top or bottom. You can customize the minimum and maximum sizes, as well as default sizes.

    0 讨论(0)
提交回复
热议问题