mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-02-02 19:27:38 +08:00
update
This commit is contained in:
parent
d347512486
commit
c5aad9feed
@ -20,7 +20,6 @@ FluWindow {
|
|||||||
launchMode: FluWindowType.SingleTask
|
launchMode: FluWindowType.SingleTask
|
||||||
fitsAppBarWindows: true
|
fitsAppBarWindows: true
|
||||||
appBar: FluAppBar {
|
appBar: FluAppBar {
|
||||||
width: window.width
|
|
||||||
height: 30
|
height: 30
|
||||||
darkText: Lang.dark_mode
|
darkText: Lang.dark_mode
|
||||||
showDark: true
|
showDark: true
|
||||||
|
@ -23,7 +23,6 @@ FluWindow {
|
|||||||
launchMode: FluWindowType.SingleTask
|
launchMode: FluWindowType.SingleTask
|
||||||
fitsAppBarWindows: true
|
fitsAppBarWindows: true
|
||||||
appBar: FluAppBar {
|
appBar: FluAppBar {
|
||||||
width: window.width
|
|
||||||
height: 30
|
height: 30
|
||||||
darkText: Lang.dark_mode
|
darkText: Lang.dark_mode
|
||||||
showDark: true
|
showDark: true
|
||||||
|
@ -46,12 +46,10 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if(uMsg == WM_NCCALCSIZE){
|
}else if(uMsg == WM_NCCALCSIZE){
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||||
NCCALCSIZE_PARAMS& sz = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
sz.rgrc[0].top -= 1;
|
sz->rgrc[0].top -= 1;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@ -161,10 +159,16 @@ void FluFrameless::componentComplete(){
|
|||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
_nativeEvent =new FramelessEventFilter(_window);
|
_nativeEvent =new FramelessEventFilter(_window);
|
||||||
qApp->installNativeEventFilter(_nativeEvent);
|
qApp->installNativeEventFilter(_nativeEvent);
|
||||||
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);
|
||||||
SetWindowPos(hWnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
|
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
class FluFrameless : public QObject, public QQmlParserStatus
|
class FluFrameless : public QObject, public QQmlParserStatus
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY_AUTO(bool,stayTop)
|
||||||
QML_NAMED_ELEMENT(FluFrameless)
|
QML_NAMED_ELEMENT(FluFrameless)
|
||||||
public:
|
public:
|
||||||
explicit FluFrameless(QObject *parent = nullptr);
|
explicit FluFrameless(QObject *parent = nullptr);
|
||||||
|
@ -16,7 +16,6 @@ Window {
|
|||||||
property bool fitsAppBarWindows: false
|
property bool fitsAppBarWindows: false
|
||||||
property Item appBar: FluAppBar {
|
property Item appBar: FluAppBar {
|
||||||
title: window.title
|
title: window.title
|
||||||
width: window.width
|
|
||||||
height: 30
|
height: 30
|
||||||
showDark: window.showDark
|
showDark: window.showDark
|
||||||
showClose: window.showClose
|
showClose: window.showClose
|
||||||
@ -87,14 +86,6 @@ Window {
|
|||||||
}
|
}
|
||||||
lifecycle.onVisible(visible)
|
lifecycle.onVisible(visible)
|
||||||
}
|
}
|
||||||
Component{
|
|
||||||
id:com_frameless
|
|
||||||
FluFrameless{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
id:loader_frameless
|
|
||||||
}
|
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool isFirstVisible: true
|
property bool isFirstVisible: true
|
||||||
@ -119,53 +110,24 @@ Window {
|
|||||||
target: window
|
target: window
|
||||||
function onClosing(event){closeListener(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
|
Component{
|
||||||
|
id:com_frameless
|
||||||
|
FluFrameless{
|
||||||
|
stayTop: window.stayTop
|
||||||
|
}
|
||||||
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
Rectangle{
|
Rectangle{
|
||||||
color: window.backgroundColor
|
color: window.backgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluLoader{
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceComponent: background
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
Component{
|
Component{
|
||||||
id:com_app_bar
|
id:com_app_bar
|
||||||
Item{
|
Item{
|
||||||
data: window.appBar
|
data: window.appBar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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
|
|
||||||
}
|
|
||||||
Component{
|
Component{
|
||||||
id:com_loading
|
id:com_loading
|
||||||
Popup{
|
Popup{
|
||||||
@ -228,6 +190,56 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluLoader{
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceComponent: background
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
id:loader_frameless
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
id:layout_content
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: {
|
||||||
|
if(FluTools.isWin()){
|
||||||
|
return window.visibility === Window.Maximized ? 8 : 0
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
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{
|
FluInfoBar{
|
||||||
id:infoBar
|
id:infoBar
|
||||||
root: window
|
root: window
|
||||||
@ -237,8 +249,8 @@ Window {
|
|||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: FluTools.isWin() ? 1/Screen.devicePixelRatio : 0
|
|
||||||
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: {
|
||||||
@ -251,6 +263,7 @@ Window {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ Window {
|
|||||||
property bool fitsAppBarWindows: false
|
property bool fitsAppBarWindows: false
|
||||||
property Item appBar: FluAppBar {
|
property Item appBar: FluAppBar {
|
||||||
title: window.title
|
title: window.title
|
||||||
width: window.width
|
|
||||||
height: 30
|
height: 30
|
||||||
showDark: window.showDark
|
showDark: window.showDark
|
||||||
showClose: window.showClose
|
showClose: window.showClose
|
||||||
@ -86,14 +85,6 @@ Window {
|
|||||||
}
|
}
|
||||||
lifecycle.onVisible(visible)
|
lifecycle.onVisible(visible)
|
||||||
}
|
}
|
||||||
Component{
|
|
||||||
id:com_frameless
|
|
||||||
FluFrameless{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FluLoader{
|
|
||||||
id:loader_frameless
|
|
||||||
}
|
|
||||||
QtObject{
|
QtObject{
|
||||||
id:d
|
id:d
|
||||||
property bool isFirstVisible: true
|
property bool isFirstVisible: true
|
||||||
@ -118,53 +109,24 @@ Window {
|
|||||||
target: window
|
target: window
|
||||||
function onClosing(event){closeListener(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
|
Component{
|
||||||
|
id:com_frameless
|
||||||
|
FluFrameless{
|
||||||
|
stayTop: window.stayTop
|
||||||
|
}
|
||||||
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
Rectangle{
|
Rectangle{
|
||||||
color: window.backgroundColor
|
color: window.backgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluLoader{
|
|
||||||
anchors.fill: parent
|
|
||||||
sourceComponent: background
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
Component{
|
Component{
|
||||||
id:com_app_bar
|
id:com_app_bar
|
||||||
Item{
|
Item{
|
||||||
data: window.appBar
|
data: window.appBar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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
|
|
||||||
}
|
|
||||||
Component{
|
Component{
|
||||||
id:com_loading
|
id:com_loading
|
||||||
Popup{
|
Popup{
|
||||||
@ -227,6 +189,56 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluLoader{
|
||||||
|
anchors.fill: parent
|
||||||
|
sourceComponent: background
|
||||||
|
}
|
||||||
|
FluLoader{
|
||||||
|
id:loader_frameless
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
id:layout_content
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: {
|
||||||
|
if(FluTools.isWin()){
|
||||||
|
return window.visibility === Window.Maximized ? 8 : 0
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
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{
|
FluInfoBar{
|
||||||
id:infoBar
|
id:infoBar
|
||||||
root: window
|
root: window
|
||||||
@ -249,6 +261,7 @@ Window {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
function destoryOnClose(){
|
function destoryOnClose(){
|
||||||
lifecycle.onDestoryOnClose()
|
lifecycle.onDestoryOnClose()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user