1.void show();
/*!
Shows the widget and its child widgets.
This is equivalent to calling showFullScreen(), showMaximized(), or setVisible(true),
depending on the platform's default behavior for the window flags.
\sa raise(), showEvent(), hide(), setVisible(), showMinimized(), showMaximized(),
showNormal(), isVisible(), windowFlags()
*/
void QWidget::show()
{
Qt::WindowState defaultState = QGuiApplicationPrivate::platformIntegration()->defaultWindowState(data->window_flags);
if (defaultState == Qt::WindowFullScreen)
showFullScreen();
else if (defaultState == Qt::WindowMaximized)
showMaximized();
else
setVisible(true); // Don't call showNormal() as not to clobber Qt::Window(Max/Min)imized
}
/*!
Shows the widget in full-screen mode.
Calling this function only affects \l{isWindow()}{windows}.
To return from full-screen mode, call showNormal().
Full-screen mode works fine under Windows, but has certain
problems under X. These problems are due to limitations of the
ICCCM protocol that specifies the communication between X11
clients and the window manager. ICCCM simply does not understand
the concept of non-decorated full-screen windows. Therefore, the
best we can do is to request a borderless window and place and
resize it to fill the entire screen. Depending on the window
manager, this may or may not work. The borderless window is
requested using MOTIF hints, which are at least partially
supported by virtually all modern window managers.
An alternative would be to bypass the window manager entirely and
create a window with the Qt::X11BypassWindowManagerHint flag. This
has other severe problems though, like totally broken keyboard focus
and very strange effects on desktop changes or when the user raises
other windows.
X11 window managers that follow modern post-ICCCM specifications
support full-screen mode properly.
\sa showNormal(), showMaximized(), show(), hide(), isVisible()
*/
void QWidget::showFullScreen()
{
ensurePolished();
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
| Qt::WindowFullScreen);
setVisible(true);
#if !defined Q_OS_QNX // On QNX this window will

本文详细介绍了Qt库中关于窗口管理的几个关键函数:show()用于显示窗口及其子窗口,依据平台默认行为选择全屏或最大化;hide()用于隐藏窗口;raise()使窗口置于顶层;lower()则将其置于底层。这些函数在窗口显示和层级控制中起着重要作用。
最低0.47元/天 解锁文章
827

被折叠的 条评论
为什么被折叠?



