This commit is contained in:
zhuzichu 2023-12-15 16:04:00 +08:00
parent 7ba06d183d
commit 95f48b51bf
3 changed files with 20 additions and 0 deletions

View File

@ -46,11 +46,13 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
}
return false;
}else if(uMsg == WM_NCCALCSIZE){
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
NCCALCSIZE_PARAMS& sz = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
if (sz.rgrc[0].top != 0)
sz.rgrc[0].top -= 1;
*result = WVR_REDRAW;
return true;
#endif
}
return false;
#endif
@ -163,6 +165,7 @@ void FluFrameless::componentComplete(){
HWND hWnd = reinterpret_cast<HWND>(_window->winId());
ULONG_PTR cNewStyle = GetClassLongPtr(hWnd, GCL_STYLE) | CS_DROPSHADOW;
SetClassLongPtr(hWnd, GCL_STYLE, cNewStyle);
SetWindowPos(hWnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
#endif
}
}

View File

@ -70,6 +70,7 @@ Window {
}
lifecycle.onCompleted(window)
initArgument(argument)
moveWindowToDesktopCenter()
if(window.autoMaximize){
window.showMaximized()
}else{
@ -248,6 +249,15 @@ Window {
}
return true
}
Rectangle{
color: parent.border.color
width: parent.width
height: 1
anchors{
top: parent.top
topMargin: 1
}
}
}
function destoryOnClose(){
lifecycle.onDestoryOnClose()
@ -275,6 +285,9 @@ Window {
function registerForWindowResult(path){
return lifecycle.createRegister(window,path)
}
function moveWindowToDesktopCenter(){
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
}
function onResult(data){
if(_pageRegister){
_pageRegister.onResult(data)

View File

@ -69,6 +69,7 @@ Window {
}
lifecycle.onCompleted(window)
initArgument(argument)
moveWindowToDesktopCenter()
if(window.autoMaximize){
window.showMaximized()
}else{
@ -274,6 +275,9 @@ Window {
function registerForWindowResult(path){
return lifecycle.createRegister(window,path)
}
function moveWindowToDesktopCenter(){
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
}
function onResult(data){
if(_pageRegister){
_pageRegister.onResult(data)