简体   繁体   中英

Resize entire QTableWidget (not columns or rows)

Probabaly a newbie question here. Is there a way for the user to drag resize QTableWidget? My QTableWidget is nested inside a tab widget, therefore it is not a window by itself. I tried implementing a QSizeGrip, but when I drag resize the grip the entire window resizes and not just the table.

If you want to allow the user to resize widgets individually, I would suggest using Multiple Document Interface (MDI). This will give each widget its own sub window that the user can move and resize and it is natural since they respond similarly to top-level windows. See this example for details.

Another option you may be looking for is a splitter. The splitter allows you to section the window and allow the user to drag the splitter location, in turn changing the sizes of the sections. See this for details.

In each of these cases, you'll want to use a layout so that the table expands to the size of its container.

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