1.void activateWindow();
/*!
\fn void QWidget::activateWindow()
Sets the top-level widget containing this widget to be the active
window.
An active window is a visible top-level window that has the
keyboard input focus.
This function performs the same operation as clicking the mouse on
the title bar of a top-level window. On X11, the result depends on
the Window Manager. If you want to ensure that the window is
stacked on top as well you should also call raise(). Note that the
window must be visible, otherwise activateWindow() has no effect.
On Windows, if you are calling this when the application is not
currently the active one then it will not make it the active
window. It will change the color of the taskbar entry to indicate
that the window has changed in some way. This is because Microsoft
does not allow an application to interrupt what the user is currently
doing in another application.
\sa isActiveWindow(), window(), show()
*/
void QWidget::activateWindow()
{
QWindow *const wnd = window()->windowHandle();
if (wnd)
wnd->requestActivate();
}
/*!
Requests the window to be activated, i.e. receive keyboard focus.
\sa isActive(), QGuiApplication::focusWindow()
*/
void QWindow::requestActivate()
{
Q_D(QWindow);
if (flags() & Qt::WindowDoesNotAcceptFocus) {
qWarning() << "requestActivat

本文详细介绍了如何在Qt中通过`activateWindow()`、`showMinimized()`、`showMaximized()`和`showFullScreen()`函数来控制窗口状态,包括激活窗口、最小化显示、最大化布局和全屏模式。特别关注了Windows平台的实现细节与限制。
最低0.47元/天 解锁文章
445

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



