mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
bf5c722058
commit
99ff310448
@ -1,6 +1,7 @@
|
||||
#include "FluFramelessHelper.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include "FluTools.h"
|
||||
#ifdef Q_OS_WIN
|
||||
#pragma comment (lib,"user32.lib")
|
||||
#pragma comment (lib,"dwmapi.lib")
|
||||
@ -13,19 +14,6 @@ static inline QByteArray qtNativeEventType()
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline bool isWindows11OrGreater() {
|
||||
DWORD dwVersion = 0;
|
||||
DWORD dwBuild = 0;
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
dwVersion = GetVersion();
|
||||
if (dwVersion < 0x80000000)
|
||||
dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||
#pragma warning(pop)
|
||||
return dwBuild >= 22000;
|
||||
}
|
||||
|
||||
|
||||
static inline bool isTaskbarAutoHide() {
|
||||
APPBARDATA appBarData;
|
||||
memset(&appBarData, 0, sizeof(appBarData));
|
||||
@ -125,7 +113,7 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
||||
}
|
||||
return false;
|
||||
}else if(uMsg == WM_NCHITTEST){
|
||||
if(isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
if(FluTools::getInstance()->isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
if (*result == HTNOWHERE) {
|
||||
*result = HTZOOM;
|
||||
}
|
||||
@ -133,14 +121,14 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
||||
}
|
||||
return false;
|
||||
}else if(uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN){
|
||||
if(isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
if(FluTools::getInstance()->isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
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(isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
if(FluTools::getInstance()->isWindows11OrGreater() && _helper->hoverMaxBtn() && _helper->resizeable()){
|
||||
QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
||||
}
|
||||
|
@ -200,15 +200,14 @@ bool FluTools::isWindows11OrGreater(){
|
||||
static QVariant var;
|
||||
if(var.isNull()){
|
||||
#if defined(Q_OS_WIN)
|
||||
DWORD dwVersion = 0;
|
||||
DWORD dwBuild = 0;
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
dwVersion = GetVersion();
|
||||
if (dwVersion < 0x80000000)
|
||||
dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||
#pragma warning(pop)
|
||||
return dwBuild >= 22000;
|
||||
QSettings regKey {QString::fromUtf8("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), QSettings::NativeFormat};
|
||||
if (regKey.contains(QString::fromUtf8("CurrentBuildNumber"))) {
|
||||
auto buildNumber = regKey.value(QString::fromUtf8("CurrentBuildNumber")).toInt();
|
||||
if(buildNumber>=22000){
|
||||
var = QVariant::fromValue(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
var = QVariant::fromValue(false);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user