mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-05-06 10:37:25 +08:00
update
This commit is contained in:
parent
1d917baac7
commit
e0c28e2693
@ -140,14 +140,8 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||||||
offsetTop = 1;
|
offsetTop = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isCompositionEnabled()){
|
|
||||||
clientRect->top = originalTop+offsetTop;
|
clientRect->top = originalTop+offsetTop;
|
||||||
}else{
|
clientRect->bottom = originalBottom-offsetTop;
|
||||||
clientRect->top = originalTop;
|
|
||||||
clientRect->bottom = originalBottom;
|
|
||||||
clientRect->left = originalLeft;
|
|
||||||
clientRect->right = originalRight;
|
|
||||||
}
|
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
return true;
|
return true;
|
||||||
}if(uMsg == WM_NCHITTEST){
|
}if(uMsg == WM_NCHITTEST){
|
||||||
@ -299,18 +293,16 @@ void FluFramelessHelper::componentComplete(){
|
|||||||
_realHeight = QQmlProperty(window,"_realHeight");
|
_realHeight = QQmlProperty(window,"_realHeight");
|
||||||
_realWidth = QQmlProperty(window,"_realWidth");
|
_realWidth = QQmlProperty(window,"_realWidth");
|
||||||
_appBarHeight = QQmlProperty(window,"_appBarHeight");
|
_appBarHeight = QQmlProperty(window,"_appBarHeight");
|
||||||
_enableMarginsBottomLeftRight = QQmlProperty(window,"_enableMarginsBottomLeftRight");
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
_enableMarginsBottomLeftRight.write(!isCompositionEnabled());
|
|
||||||
window->setFlag(Qt::CustomizeWindowHint,true);
|
window->setFlag(Qt::CustomizeWindowHint,true);
|
||||||
_nativeEvent =new FramelessEventFilter(this);
|
_nativeEvent =new FramelessEventFilter(this);
|
||||||
qApp->installNativeEventFilter(_nativeEvent);
|
qApp->installNativeEventFilter(_nativeEvent);
|
||||||
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
||||||
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||||
if(resizeable()){
|
if(resizeable()){
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME);
|
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_BORDER);
|
||||||
}else{
|
}else{
|
||||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);
|
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_BORDER);
|
||||||
}
|
}
|
||||||
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);
|
||||||
showShadow(hwnd);
|
showShadow(hwnd);
|
||||||
|
@ -61,7 +61,6 @@ private:
|
|||||||
QQmlProperty _realHeight;
|
QQmlProperty _realHeight;
|
||||||
QQmlProperty _realWidth;
|
QQmlProperty _realWidth;
|
||||||
QQmlProperty _appBarHeight;
|
QQmlProperty _appBarHeight;
|
||||||
QQmlProperty _enableMarginsBottomLeftRight;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUFRAMELESSHELPER_H
|
#endif // FLUFRAMELESSHELPER_H
|
||||||
|
@ -64,7 +64,6 @@ Window {
|
|||||||
property int _realHeight
|
property int _realHeight
|
||||||
property int _realWidth
|
property int _realWidth
|
||||||
property int _appBarHeight: appBar.height
|
property int _appBarHeight: appBar.height
|
||||||
property bool _enableMarginsBottomLeftRight: false
|
|
||||||
id:window
|
id:window
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -210,9 +209,7 @@ Window {
|
|||||||
anchors{
|
anchors{
|
||||||
fill:parent
|
fill:parent
|
||||||
topMargin: _offsetXY.y
|
topMargin: _offsetXY.y
|
||||||
bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0
|
bottomMargin: _offsetXY.y
|
||||||
leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
|
||||||
rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
|
||||||
}
|
}
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
window.appBar.width = width
|
window.appBar.width = width
|
||||||
|
@ -63,7 +63,6 @@ Window {
|
|||||||
property int _realHeight
|
property int _realHeight
|
||||||
property int _realWidth
|
property int _realWidth
|
||||||
property int _appBarHeight: appBar.height
|
property int _appBarHeight: appBar.height
|
||||||
property bool _enableMarginsBottomLeftRight: false
|
|
||||||
id:window
|
id:window
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@ -209,9 +208,7 @@ Window {
|
|||||||
anchors{
|
anchors{
|
||||||
fill:parent
|
fill:parent
|
||||||
topMargin: _offsetXY.y
|
topMargin: _offsetXY.y
|
||||||
bottomMargin: _enableMarginsBottomLeftRight ? _offsetXY.y : 0
|
bottomMargin: _offsetXY.y
|
||||||
leftMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
|
||||||
rightMargin: _enableMarginsBottomLeftRight ? _offsetXY.x : 0
|
|
||||||
}
|
}
|
||||||
onWidthChanged: {
|
onWidthChanged: {
|
||||||
window.appBar.width = width
|
window.appBar.width = width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user