mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-04-25 12:29:43 +08:00
update
This commit is contained in:
parent
9adb6b645b
commit
9f652a7c76
@ -33,7 +33,7 @@ static inline bool isCompositionEnabled(){
|
|||||||
|
|
||||||
static inline void showShadow(HWND hwnd){
|
static inline void showShadow(HWND hwnd){
|
||||||
if(isCompositionEnabled()){
|
if(isCompositionEnabled()){
|
||||||
const MARGINS shadow = { 1, 0, 0, 0 };
|
const MARGINS shadow = { 1, 1, 1, 1 };
|
||||||
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
|
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
|
||||||
HMODULE module = LoadLibraryW(L"dwmapi.dll");
|
HMODULE module = LoadLibraryW(L"dwmapi.dll");
|
||||||
if (module)
|
if (module)
|
||||||
@ -113,14 +113,6 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||||||
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if(uMsg == WM_GETMINMAXINFO){
|
|
||||||
if(IsZoomed(hwnd)){
|
|
||||||
RECT frame = {0,0,0,0};
|
|
||||||
AdjustWindowRectEx(&frame,WS_OVERLAPPEDWINDOW,FALSE,0);
|
|
||||||
_helper->setOffsetXY(QPoint(floor(abs(frame.left)/_helper->window->devicePixelRatio()),floor(abs(frame.bottom)/_helper->window->devicePixelRatio())));
|
|
||||||
}else{
|
|
||||||
_helper->setOffsetXY(QPoint(0,0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@ -247,7 +239,6 @@ void FluFramelessHelper::componentComplete(){
|
|||||||
#endif
|
#endif
|
||||||
_stayTop = QQmlProperty(window,"stayTop");
|
_stayTop = QQmlProperty(window,"stayTop");
|
||||||
_screen = QQmlProperty(window,"screen");
|
_screen = QQmlProperty(window,"screen");
|
||||||
_offsetXY = QQmlProperty(window,"_offsetXY");
|
|
||||||
_onStayTopChange();
|
_onStayTopChange();
|
||||||
_stayTop.connectNotifySignal(this,SLOT(_onStayTopChange()));
|
_stayTop.connectNotifySignal(this,SLOT(_onStayTopChange()));
|
||||||
_screen.connectNotifySignal(this,SLOT(_onScreenChanged()));
|
_screen.connectNotifySignal(this,SLOT(_onScreenChanged()));
|
||||||
@ -341,10 +332,6 @@ QObject* FluFramelessHelper::maximizeButton(){
|
|||||||
return var.value<QObject*>();
|
return var.value<QObject*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluFramelessHelper::setOffsetXY(QPoint val){
|
|
||||||
_offsetXY.write(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FluFramelessHelper::resizeable(){
|
bool FluFramelessHelper::resizeable(){
|
||||||
return !(window->width() == window->maximumWidth() && window->width() == window->minimumWidth() && window->height() == window->maximumHeight() && window->height() == window->minimumHeight());
|
return !(window->width() == window->maximumWidth() && window->width() == window->minimumWidth() && window->height() == window->maximumHeight() && window->height() == window->minimumHeight());
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ public:
|
|||||||
bool hoverMaxBtn();
|
bool hoverMaxBtn();
|
||||||
bool resizeable();
|
bool resizeable();
|
||||||
QObject* maximizeButton();
|
QObject* maximizeButton();
|
||||||
void setOffsetXY(QPoint val);
|
|
||||||
Q_INVOKABLE void showSystemMenu();
|
Q_INVOKABLE void showSystemMenu();
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
@ -55,7 +54,6 @@ private:
|
|||||||
FramelessEventFilter* _nativeEvent = nullptr;
|
FramelessEventFilter* _nativeEvent = nullptr;
|
||||||
QQmlProperty _stayTop;
|
QQmlProperty _stayTop;
|
||||||
QQmlProperty _screen;
|
QQmlProperty _screen;
|
||||||
QQmlProperty _offsetXY;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUFRAMELESSHELPER_H
|
#endif // FLUFRAMELESSHELPER_H
|
||||||
|
@ -73,6 +73,19 @@ Window {
|
|||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
lifecycle.onDestruction()
|
lifecycle.onDestruction()
|
||||||
}
|
}
|
||||||
|
onVisibilityChanged: {
|
||||||
|
if(visibility === Window.Maximized || visibility === Window.FullScreen){
|
||||||
|
var dx = window.x-Screen.virtualX
|
||||||
|
var dy = window.y-Screen.virtualY
|
||||||
|
if(dx<0 && dy<0){
|
||||||
|
_offsetXY = Qt.point(Math.abs(dx+1),Math.abs(dy+1))
|
||||||
|
}else{
|
||||||
|
_offsetXY = Qt.point(0,0)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
_offsetXY = Qt.point(0,0)
|
||||||
|
}
|
||||||
|
}
|
||||||
onShowSystemMenu: {
|
onShowSystemMenu: {
|
||||||
if(loader_frameless_helper.item){
|
if(loader_frameless_helper.item){
|
||||||
loader_frameless_helper.item.showSystemMenu()
|
loader_frameless_helper.item.showSystemMenu()
|
||||||
|
@ -72,6 +72,19 @@ Window {
|
|||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
lifecycle.onDestruction()
|
lifecycle.onDestruction()
|
||||||
}
|
}
|
||||||
|
onVisibilityChanged: {
|
||||||
|
if(visibility === Window.Maximized || visibility === Window.FullScreen){
|
||||||
|
var dx = window.x-Screen.virtualX
|
||||||
|
var dy = window.y-Screen.virtualY
|
||||||
|
if(dx<0 && dy<0){
|
||||||
|
_offsetXY = Qt.point(Math.abs(dx+1),Math.abs(dy+1))
|
||||||
|
}else{
|
||||||
|
_offsetXY = Qt.point(0,0)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
_offsetXY = Qt.point(0,0)
|
||||||
|
}
|
||||||
|
}
|
||||||
onShowSystemMenu: {
|
onShowSystemMenu: {
|
||||||
if(loader_frameless_helper.item){
|
if(loader_frameless_helper.item){
|
||||||
loader_frameless_helper.item.showSystemMenu()
|
loader_frameless_helper.item.showSystemMenu()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user