mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-02-09 00:05:39 +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,71 +197,60 @@ Window {
|
|||||||
FluLoader{
|
FluLoader{
|
||||||
id:loader_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
|
onWidthChanged: {
|
||||||
|
window.appBar.width = width
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
id:loader_app_bar
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
height: {
|
||||||
|
if(window.useSystemAppBar){
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return window.fitsAppBarWindows ? 0 : window.appBar.height
|
||||||
|
}
|
||||||
|
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:layout_content
|
id:container
|
||||||
|
anchors{
|
||||||
|
top: loader_app_bar.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
property string loadingText: "加载中..."
|
||||||
|
property bool cancel: false
|
||||||
|
id:loader_loading
|
||||||
|
anchors.fill: container
|
||||||
|
}
|
||||||
|
FluInfoBar{
|
||||||
|
id:infoBar
|
||||||
|
root: window
|
||||||
|
}
|
||||||
|
WindowLifecycle{
|
||||||
|
id:lifecycle
|
||||||
|
}
|
||||||
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: {
|
color:"transparent"
|
||||||
if(FluTools.isWin() && !window.useSystemAppBar){
|
border.width: window.resizeBorderWidth
|
||||||
return window.visibility === Window.Maximized ? 8 : 0
|
border.color: window.resizeBorderColor
|
||||||
|
visible: {
|
||||||
|
if(window.useSystemAppBar){
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return 0
|
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
||||||
}
|
return false
|
||||||
onWidthChanged: {
|
|
||||||
window.appBar.width = width
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
id:loader_app_bar
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
height: {
|
|
||||||
if(window.useSystemAppBar){
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return window.fitsAppBarWindows ? 0 : window.appBar.height
|
|
||||||
}
|
|
||||||
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
|
||||||
}
|
|
||||||
Item{
|
|
||||||
id:container
|
|
||||||
anchors{
|
|
||||||
top: loader_app_bar.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
clip: true
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
property string loadingText: "加载中..."
|
|
||||||
property bool cancel: false
|
|
||||||
id:loader_loading
|
|
||||||
anchors.fill: container
|
|
||||||
}
|
|
||||||
FluInfoBar{
|
|
||||||
id:infoBar
|
|
||||||
root: window
|
|
||||||
}
|
|
||||||
WindowLifecycle{
|
|
||||||
id:lifecycle
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
anchors.fill: parent
|
|
||||||
color:"transparent"
|
|
||||||
anchors.topMargin: FluTools.isWin() ? 1/Screen.devicePixelRatio : 0
|
|
||||||
border.width: window.resizeBorderWidth
|
|
||||||
border.color: window.resizeBorderColor
|
|
||||||
visible: {
|
|
||||||
if(window.useSystemAppBar){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
|
@ -196,70 +196,60 @@ Window {
|
|||||||
FluLoader{
|
FluLoader{
|
||||||
id:loader_frameless
|
id:loader_frameless
|
||||||
}
|
}
|
||||||
|
onWidthChanged: {
|
||||||
|
window.appBar.width = width
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
id:loader_app_bar
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
height: {
|
||||||
|
if(window.useSystemAppBar){
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return window.fitsAppBarWindows ? 0 : window.appBar.height
|
||||||
|
}
|
||||||
|
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:layout_content
|
id:container
|
||||||
|
anchors{
|
||||||
|
top: loader_app_bar.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
property string loadingText: "加载中..."
|
||||||
|
property bool cancel: false
|
||||||
|
id:loader_loading
|
||||||
|
anchors.fill: container
|
||||||
|
}
|
||||||
|
FluInfoBar{
|
||||||
|
id:infoBar
|
||||||
|
root: window
|
||||||
|
}
|
||||||
|
WindowLifecycle{
|
||||||
|
id:lifecycle
|
||||||
|
}
|
||||||
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: {
|
color:"transparent"
|
||||||
if(FluTools.isWin() && !window.useSystemAppBar){
|
border.width: window.resizeBorderWidth
|
||||||
return window.visibility === Window.Maximized ? 8 : 0
|
border.color: window.resizeBorderColor
|
||||||
|
visible: {
|
||||||
|
if(window.useSystemAppBar){
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return 0
|
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
||||||
}
|
return false
|
||||||
onWidthChanged: {
|
|
||||||
window.appBar.width = width
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
id:loader_app_bar
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
height: {
|
|
||||||
if(window.useSystemAppBar){
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
return window.fitsAppBarWindows ? 0 : window.appBar.height
|
|
||||||
}
|
|
||||||
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
|
||||||
}
|
|
||||||
Item{
|
|
||||||
id:container
|
|
||||||
anchors{
|
|
||||||
top: loader_app_bar.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
clip: true
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
property string loadingText: "加载中..."
|
|
||||||
property bool cancel: false
|
|
||||||
id:loader_loading
|
|
||||||
anchors.fill: container
|
|
||||||
}
|
|
||||||
FluInfoBar{
|
|
||||||
id:infoBar
|
|
||||||
root: window
|
|
||||||
}
|
|
||||||
WindowLifecycle{
|
|
||||||
id:lifecycle
|
|
||||||
}
|
|
||||||
Rectangle{
|
|
||||||
anchors.fill: parent
|
|
||||||
color:"transparent"
|
|
||||||
border.width: window.resizeBorderWidth
|
|
||||||
border.color: window.resizeBorderColor
|
|
||||||
visible: {
|
|
||||||
if(window.useSystemAppBar){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user