This commit is contained in:
朱子楚\zhuzi 2024-03-10 12:01:31 +08:00
parent db89d2485c
commit ea69589c0a
3 changed files with 14 additions and 8 deletions

View File

@ -155,18 +155,16 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
*result = HTCLIENT;
return true;
}else if(uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN){
if(FluTools::getInstance()->isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
if(_helper->hoverMaxBtn()){
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
return true;
}
return false;
}else if(uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP){
if(FluTools::getInstance()->isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
if(_helper->hoverMaxBtn()){
QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
}
return false;
}else if(uMsg == WM_NCPAINT){
*result = FALSE;
return true;

View File

@ -253,7 +253,7 @@ Rectangle{
Layout.preferredHeight: 30
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: {
if(pressed){
if(down){
return maximizePressColor
}
if(FluTools.isWindows11OrGreater()){
@ -291,9 +291,13 @@ Rectangle{
}
function _maximizeButtonHover(){
var hover = false
if(btn_maximize.visible){
if(btn_maximize.visible && FluTools.isWindows11OrGreater() && d.resizable){
if(d.containsPointToItem(FluTools.cursorPos(),btn_maximize)){
hover = true
}else{
if(btn_maximize.down){
btn_maximize.down = false
}
}
}
d.hoverMaxBtn = hover

View File

@ -253,7 +253,7 @@ Rectangle{
Layout.preferredHeight: 30
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: {
if(pressed){
if(down){
return maximizePressColor
}
if(FluTools.isWindows11OrGreater()){
@ -291,9 +291,13 @@ Rectangle{
}
function _maximizeButtonHover(){
var hover = false
if(btn_maximize.visible){
if(btn_maximize.visible && FluTools.isWindows11OrGreater() && d.resizable){
if(d.containsPointToItem(FluTools.cursorPos(),btn_maximize)){
hover = true
}else{
if(btn_maximize.down){
btn_maximize.down = false
}
}
}
d.hoverMaxBtn = hover