This commit is contained in:
朱子楚\zhuzi 2023-12-12 00:49:12 +08:00
parent 6b6dbf27a1
commit 863c88411b
5 changed files with 6 additions and 34 deletions

View File

@ -83,7 +83,6 @@ FluScrollablePage{
anchors.verticalCenter: parent.verticalCenter
onClicked: {
FluApp.useSystemAppBar = !FluApp.useSystemAppBar
dialog_restart.open()
}
}
}

View File

@ -86,7 +86,6 @@ FluScrollablePage{
anchors.verticalCenter: parent.verticalCenter
onClicked: {
FluApp.useSystemAppBar = !FluApp.useSystemAppBar
dialog_restart.open()
}
}
}

View File

@ -124,7 +124,6 @@ endif()
#mingwlibxxxlib module "FluentUI" plugin "fluentuiplugin" not found
if(MINGW)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX ".debug")
endif()
#MSVC Debug dQt

View File

@ -15,39 +15,14 @@
#include <winuser.h>
#include <dwmapi.h>
#include <codecvt>
#include <cmath>
static inline QByteArray qtNativeEventType()
{
static const auto result = "windows_generic_MSG";
return result;
}
int getSystemMetrics2(const WId windowId, const int index, const bool scaled){
Q_ASSERT(windowId);
if (!windowId) {
return 0;
}
const UINT realDpi = GetDpiForWindow(reinterpret_cast<HWND>(windowId));
{
const UINT dpi = (scaled ? realDpi : USER_DEFAULT_SCREEN_DPI);
if (const int result = GetSystemMetricsForDpi(index, dpi); result > 0) {
return result;
}
}
const qreal dpr = (scaled ? qreal(1) : (qreal(realDpi) / qreal(USER_DEFAULT_SCREEN_DPI)));
return std::round(qreal(::GetSystemMetrics(index)) / dpr);
}
quint32 getResizeBorderThickness(const WId windowId, const bool scaled){
if (!windowId) {
return 0;
}
return getSystemMetrics2(windowId, SM_CXSIZEFRAME, scaled) + getSystemMetrics2(windowId, SM_CXPADDEDBORDER, scaled);
}
#endif
FramelessEventFilter::FramelessEventFilter(QQuickWindow* window){
_window = window;
_current = window->winId();
@ -73,7 +48,7 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
return false;
}
const LPARAM lParam = msg->lParam;
const int borderPadding = getResizeBorderThickness(_window->winId(), true);
const int borderPadding = 8;
if (uMsg == WM_NCCALCSIZE) {
if (_window->visibility() == QWindow::FullScreen) {
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
@ -256,9 +231,9 @@ void FluFrameless::componentComplete(){
if(!_window.isNull()){
_nativeEvent =new FramelessEventFilter(_window);
qApp->installNativeEventFilter(_nativeEvent);
MARGINS margins[2]{{0, 0, 0, 0}, {0, 0, 1, 0}};
HWND hWnd = reinterpret_cast<HWND>(_window->winId());
DwmExtendFrameIntoClientArea(hWnd, &margins[false]);
// MARGINS margins[2]{{0, 0, 0, 0}, {0, 0, 1, 0}};
// HWND hWnd = reinterpret_cast<HWND>(_window->winId());
// DwmExtendFrameIntoClientArea(hWnd, &margins[false]);
refresLayout();
connect(_window,&QWindow::visibilityChanged,this,[=](QWindow::Visibility visibility){ refresLayout(); });
}

View File

@ -36,7 +36,7 @@ Window {
property bool showMinimize: true
property bool showMaximize: true
property bool showStayTop: true
flags: Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
property bool autoMaximize: false
property var closeListener: function(event){
if(closeDestory){