Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在win7系统没有阴影边框 鼠标拖动到屏幕左上右边缘没有系统的动画效果 #12

Open
chifandeyu opened this issue Dec 9, 2020 · 4 comments

Comments

@chifandeyu
Copy link

鼠标拖动到屏幕左上右边缘没有系统的动画效果,且鼠标光标会圈圈
image
image
是在win7虚拟机测试的

@hcaihao
Copy link

hcaihao commented Aug 4, 2021

same problem, and cannot maximized when double click header.

@564398053
Copy link

源码中的 if (currentVersion < QOperatingSystemVersion::Windows8) 未对win8以下的系统进行处理,
同时,在win10下某些机器上会导致显示错位的的问题

void NativeWindowHelperPrivate::updateWindowStyle()
{
    Q_Q(NativeWindowHelper);

    Q_CHECK_PTR(window);

    HWND hWnd = reinterpret_cast<HWND>(window->winId());
    if (NULL == hWnd)
        return;
    else if (oldWindow == hWnd)
    {
        return;
    }
    oldWindow = hWnd;

    NativeWindowFilter::deliver(window, q);

    QOperatingSystemVersion currentVersion = QOperatingSystemVersion::current();
    if (currentVersion < QOperatingSystemVersion::Windows8)
    {
        return;
    }

    LONG oldStyle = WS_OVERLAPPEDWINDOW | WS_THICKFRAME
                    | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;;
    LONG newStyle = WS_POPUP            | WS_THICKFRAME;

    if (QtWin::isCompositionEnabled())
        newStyle |= WS_CAPTION;

    if (window->flags() & Qt::CustomizeWindowHint)
    {
        if (window->flags() & Qt::WindowSystemMenuHint)
            newStyle |= WS_SYSMENU;
        if (window->flags() & Qt::WindowMinimizeButtonHint)
            newStyle |= WS_MINIMIZEBOX;
        if (window->flags() & Qt::WindowMaximizeButtonHint)
            newStyle |= WS_MAXIMIZEBOX;
    }
    else
    {
        newStyle |= WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
    }

    LONG currentStyle = GetWindowLong(hWnd, GWL_STYLE);
    SetWindowLong(hWnd, GWL_STYLE, (currentStyle & ~oldStyle) | newStyle);


    SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
    SWP_NOOWNERZORDER | SWP_NOZORDER |
    SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);

    if (QtWin::isCompositionEnabled())
        QtWin::extendFrameIntoClientArea(window, 1, 1, 1, 1);
}

@jxiaow
Copy link

jxiaow commented Feb 24, 2022

@hcaihao @564398053 内容显示错乱,两位大佬有好的解决方法吗?

@hcaihao
Copy link

hcaihao commented Feb 25, 2022

Try StyleWindow in my repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants