mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
2acb3c34bd
commit
cd984fddf5
@ -63,14 +63,14 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
||||
}
|
||||
properties.insert("argument",argument);
|
||||
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
view->setFlag(Qt::FramelessWindowHint,true);
|
||||
}
|
||||
wnds.insert(view->winId(),view);
|
||||
if(fluRegister){
|
||||
fluRegister->to(view);
|
||||
}
|
||||
view->setColor(QColor(Qt::transparent));
|
||||
if(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight()){
|
||||
view->resize(view->minimumSize());
|
||||
}
|
||||
view->show();
|
||||
}
|
||||
|
||||
|
@ -23,16 +23,24 @@ WindowHelper::WindowHelper(QObject *parent)
|
||||
|
||||
void WindowHelper::initWindow(QQuickWindow* window){
|
||||
this->window = window;
|
||||
}
|
||||
|
||||
void WindowHelper::firstUpdate(){
|
||||
if(isFisrt){
|
||||
#ifdef Q_OS_WIN
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
HWND wnd = (HWND)window->winId();
|
||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
ShowWindow(wnd, SW_SHOW);
|
||||
}
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
HWND wnd = (HWND)window->winId();
|
||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
ShowWindow(wnd, SW_SHOW);
|
||||
window->setFlag(Qt::FramelessWindowHint,false);
|
||||
}
|
||||
#endif
|
||||
isFisrt = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QVariant WindowHelper::createRegister(const QString& path){
|
||||
|
@ -18,8 +18,11 @@ public:
|
||||
Q_INVOKABLE void destoryWindow();
|
||||
Q_INVOKABLE QVariant createRegister(const QString& path);
|
||||
|
||||
Q_INVOKABLE void firstUpdate();
|
||||
|
||||
private:
|
||||
QQuickWindow* window;
|
||||
bool isFisrt=true;
|
||||
};
|
||||
|
||||
#endif // WINDOWHELPER_H
|
||||
|
@ -32,6 +32,12 @@ ApplicationWindow {
|
||||
clip: true
|
||||
}
|
||||
|
||||
onActiveChanged: {
|
||||
if(active){
|
||||
helper.firstUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
onClosing:
|
||||
(event)=>{
|
||||
//销毁窗口,释放资源
|
||||
|
Loading…
Reference in New Issue
Block a user