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; *result = HTCLIENT;
return true; return true;
}else if(uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN){ }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); QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_helper->maximizeButton(),&event); QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
return true; return true;
} }
return false;
}else if(uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP){ }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); QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QGuiApplication::sendEvent(_helper->maximizeButton(),&event); QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
} }
return false;
}else if(uMsg == WM_NCPAINT){ }else if(uMsg == WM_NCPAINT){
*result = FALSE; *result = FALSE;
return true; return true;

View File

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

View File

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