This commit is contained in:
zhuzichu 2024-01-08 16:40:19 +08:00
parent 993de241cb
commit f04bc2951f
2 changed files with 11 additions and 8 deletions

View File

@ -81,10 +81,10 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
return true; return true;
} }
int offsetSize = 0; int offsetSize = 0;
bool isMax = IsZoomed(hwnd); bool isMaximum = IsZoomed(hwnd);
offsetXY = QPoint(abs(clientRect->left - originalLeft),abs(clientRect->top - originalTop)); offsetXY = QPoint(abs(clientRect->left - originalLeft),abs(clientRect->top - originalTop));
if(isCompositionEnabled()){ if(isCompositionEnabled()){
if(isMax){ if(isMaximum){
_helper->setOriginalPos(QPoint(originalLeft,originalTop)); _helper->setOriginalPos(QPoint(originalLeft,originalTop));
offsetSize = 0; offsetSize = 0;
}else{ }else{
@ -96,9 +96,11 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
} }
clientRect->top = originalTop+offsetSize; clientRect->top = originalTop+offsetSize;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0) #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
if(!isMaximum){
clientRect->bottom = originalBottom-offsetSize; clientRect->bottom = originalBottom-offsetSize;
clientRect->left = originalLeft+offsetSize; clientRect->left = originalLeft+offsetSize;
clientRect->right = originalRight-offsetSize; clientRect->right = originalRight-offsetSize;
}
#endif #endif
*result = WVR_REDRAW; *result = WVR_REDRAW;
return true; return true;

View File

@ -206,12 +206,13 @@ Window {
} }
Item{ Item{
id:layout_container id:layout_container
property bool isMaximum : window.visibility == Window.Maximized
anchors{ anchors{
fill:parent fill:parent
topMargin: _offsetXY.y topMargin: _offsetXY.y
bottomMargin: _offsetXY.y bottomMargin: isMaximum ? 0 : _offsetXY.y
leftMargin: _offsetXY.x leftMargin: isMaximum ? 0 :_offsetXY.x
rightMargin: _offsetXY.x rightMargin: isMaximum ? 0 : _offsetXY.x
} }
onWidthChanged: { onWidthChanged: {
window.appBar.width = width window.appBar.width = width