stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
442 stars 67 forks source link

Window设置maximumHeight和minimumHeight为同一个数值时,实际窗口高度会大31 #76

Open ZhongHuaRong opened 2 months ago

ZhongHuaRong commented 2 months ago

image
使用的qt 5.15.13测试,显示窗口时会比默认设置的高31,拖动窗口后会恢复到设置的数值

SineStriker commented 2 months ago

确实,widget也有这个问题。这个问题我看了一下比较复杂,暂时不太好解决,现在还是请尽量在setup以后再调整尺寸。

ZhongHuaRong commented 2 months ago

试了一下,需要在窗口显示之后再显式设置高度(随便一个数值),然后通过centralize居中

Window {
    id: window
    maximumHeight: 600
    minimumHeight: 600
    maximumWidth: 800
    minimumWidth: 800
    Component.onCompleted: {
        windowAgent.setup(window)
        window.visible = true
        window.height = maximumHeight
        windowAgent.centralize()
    }
}

这个bug Ubuntu下未复现

wangwenx190 commented 2 months ago

我们结论是需要先setup然后再去改minimum width/height/size以及maximum width/height/size,QWidget和QtQuick都是这样