Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前的表单中有大约 4 个小部件,我想知道是否有办法最小化表单上的小部件,然后在需要时再次恢复它们。我熟悉的一种方法是使用框架并将小部件放置在框架上,然后在需要时隐藏框架。有没有更好的方法或其他方法?
这是一个隐藏每个小部件的片段。
foreach (QWidget* widget, QApplication::topLevelWidgets()) { widget->hide(); }
由于您拥有小部件对象,因此您可以使用此小部件做任何您想做的事情。