请原谅这个可能令人讨厌的问题,但是在尝试隐藏QWidget时,调用setVisible(False),setShown(False)和hide()有什么区别?
Please excuse this potentially noobish question but when trying to hide a QWidget what is the difference between calling setVisible(False), setShown(False) and hide()?
推荐答案show()只是setVisible(true)的便捷功能.
类似地,hide()等同于setVisible(false)
在内部,相同的代码用于呈现视图.
Internally, the same code is used to render your view.
请参见 doc.qt.io/archives/qt-4.7/qwidget. html#show 为例.根据它,
void QWidget :: show()[slot]显示窗口小部件及其子窗口小部件. 此功能等效于setVisible(true).
void QWidget::show () [slot] Shows the widget and its child widgets. This function is equivalent to setVisible(true).
您会在Qt中找到许多这样的功能,它们只是使事情变得更直观,尤其是在小部件和视图方面.
You'll find lots of such functions in Qt to just make things more intuitive, especially when it comes to widgets and views.
更多推荐
setVisible,setShown和show/hide之间的Qt有什么区别
发布评论