mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-02-09 08:15:41 +08:00
update
This commit is contained in:
parent
5e38493403
commit
ecd0f29d30
@ -1,7 +1,7 @@
|
|||||||
#include "FluFrameless.h"
|
#include "FluFrameless.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
#include <QOperatingSystemVersion>
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#pragma comment(lib, "user32.lib")
|
#pragma comment(lib, "user32.lib")
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -46,10 +46,11 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if(uMsg == WM_NCCALCSIZE){
|
}else if(uMsg == WM_NCCALCSIZE){
|
||||||
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
sz->rgrc[0].top -= 1;
|
|
||||||
return true;
|
return true;
|
||||||
|
}else if(uMsg == WM_NCPAINT){
|
||||||
|
*result = WVR_REDRAW;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@ -90,6 +91,7 @@ void FluFrameless::updateCursor(int edges){
|
|||||||
|
|
||||||
bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
|
bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
|
||||||
if (!_window.isNull() && _window->flags()& Qt::FramelessWindowHint) {
|
if (!_window.isNull() && _window->flags()& Qt::FramelessWindowHint) {
|
||||||
|
|
||||||
static int edges = 0;
|
static int edges = 0;
|
||||||
const int margin = 8;
|
const int margin = 8;
|
||||||
switch (ev->type()) {
|
switch (ev->type()) {
|
||||||
@ -162,13 +164,7 @@ void FluFrameless::componentComplete(){
|
|||||||
HWND hwnd = reinterpret_cast<HWND>(_window->winId());
|
HWND hwnd = reinterpret_cast<HWND>(_window->winId());
|
||||||
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
|
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
|
||||||
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
|
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
|
||||||
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
|
||||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
|
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
|
||||||
SetWindowLong(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
|
|
||||||
connect(this,&FluFrameless::stayTopChanged,this,[this,hwnd](){
|
|
||||||
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
|
||||||
SetWindowLong(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
|
|
||||||
});
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,15 +197,6 @@ Window {
|
|||||||
FluLoader{
|
FluLoader{
|
||||||
id:loader_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
Item{
|
|
||||||
id:layout_content
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: {
|
|
||||||
if(FluTools.isWin() && !window.useSystemAppBar){
|
|
||||||
return window.visibility === Window.Maximized ? 8 : 0
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
window.appBar.width = width
|
window.appBar.width = width
|
||||||
}
|
}
|
||||||
@ -250,7 +241,6 @@ Window {
|
|||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
anchors.topMargin: FluTools.isWin() ? 1/Screen.devicePixelRatio : 0
|
|
||||||
border.width: window.resizeBorderWidth
|
border.width: window.resizeBorderWidth
|
||||||
border.color: window.resizeBorderColor
|
border.color: window.resizeBorderColor
|
||||||
visible: {
|
visible: {
|
||||||
@ -263,7 +253,6 @@ Window {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
|
@ -196,15 +196,6 @@ Window {
|
|||||||
FluLoader{
|
FluLoader{
|
||||||
id:loader_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
Item{
|
|
||||||
id:layout_content
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: {
|
|
||||||
if(FluTools.isWin() && !window.useSystemAppBar){
|
|
||||||
return window.visibility === Window.Maximized ? 8 : 0
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
window.appBar.width = width
|
window.appBar.width = width
|
||||||
}
|
}
|
||||||
@ -261,7 +252,6 @@ Window {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user