setVisible,setShown和show/hide之间的Qt有什么区别

编程入门 行业动态 更新时间:2024-10-28 21:29:58
本文介绍了setVisible,setShown和show/hide之间的Qt有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

请原谅这个可能令人讨厌的问题,但是在尝试隐藏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有什么区别

本文发布于:2023-07-29 19:28:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1243428.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   setShown   setVisible   show   Qt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!