Qt源码分析--QWidget(2)--Top-level windows

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

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天天进步2015

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值