简体   繁体   中英

Qt - How to clear the contents of a QGroupBox UI object

This question is pretty straightforward: I have a QGroupBox object that initially has a QTableView inside of it. When the user clicks a certain button, I need the QTableView object to be removed, leaving just an empty QGroupBox. I know I can use addWidget() to create a table inside of the QGroupBox, but after looking around the docs for a while I'm having a hard time finding a similar function to remove widgets. Is there any way to do this? Thanks!

Note: I just found that there's an isEmpty() function related to the groupBox->layout(), is there maybe something similar with the layout to access the widgets if that function returns false?

您可以使用QTableView :: hide()将其从QGroupBox中隐藏。

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