简体   繁体   中英

Allow user to resize widgets at runtime in QT5

I have an application written in C++/QT5 with a QListView widget within a QHBoxLayout within a QGroupBox. There is also a QTabWidget in the main window. I would like the user to be able to resize the QListView widget by clicking and dragging and for the other items to automatically resize themselves accordingly.

I feel like this should be something that is easily done within the framework of QT5, but I can't for the life of me find a way. Even having a border on the list view that I can resize within the code of my application would be a start.

Thanks to jhnnslschnr I was able to solve this via the QSplitter widget. If you're using QtCreator as I was, you can use QSplitter simply by Ctrl-clicking the widgets you want in the splitter and then selecting "Lay out horizontally (vertically) in splitter". The user can now select the partitioning at run-time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM