setVisible,setShown和show/hide之间的Qt有什么区别 [英] What's the difference in Qt between setVisible, setShown and show/hide
问题描述
请原谅这个可能令人讨厌的问题,但是在尝试隐藏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.
请参见 http://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有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!