mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
FluWindowd新增launchMode枚举值,支持Standard、SingleTask、SingleInstance
This commit is contained in:
parent
f43bfec992
commit
ab0fcf5d9c
@ -3,6 +3,7 @@ CONFIG += c++17
|
||||
DEFINES += QT_DEPRECATED_WARNINGS QT_NO_WARNING_OUTPUT
|
||||
|
||||
HEADERS += \
|
||||
stdafx.h \
|
||||
ChatController.h \
|
||||
AppInfo.h
|
||||
|
||||
|
@ -13,6 +13,7 @@ FluWindow {
|
||||
minimumHeight: 600
|
||||
maximumWidth: 500
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleTask
|
||||
|
||||
title:"关于"
|
||||
|
||||
|
@ -58,11 +58,33 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
||||
QQmlEngine *engine = qmlEngine(appWindow);
|
||||
QQmlComponent component(engine, routes().value(route).toString());
|
||||
QVariantMap properties;
|
||||
properties.insert("route",route);
|
||||
if(fluRegister){
|
||||
properties.insert("pageRegister",QVariant::fromValue(fluRegister));
|
||||
}
|
||||
properties.insert("argument",argument);
|
||||
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||
|
||||
int launchMode = view->property("launchMode").toInt();
|
||||
if(launchMode==1){
|
||||
for (auto& pair : wnds) {
|
||||
QString r = pair->property("route").toString();
|
||||
if(r == route){
|
||||
pair->requestActivate();
|
||||
delete view;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}else if(launchMode==2){
|
||||
for (auto& pair : wnds) {
|
||||
QString r = pair->property("route").toString();
|
||||
if(r == route){
|
||||
pair->close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(FluTheme::getInstance()->frameless()){
|
||||
view->setFlag(Qt::FramelessWindowHint,true);
|
||||
}
|
||||
|
@ -6,11 +6,21 @@ import FluentUI
|
||||
|
||||
ApplicationWindow {
|
||||
|
||||
id:window
|
||||
|
||||
enum LaunchMode {
|
||||
Standard,
|
||||
SingleTask,
|
||||
SingleInstance
|
||||
}
|
||||
|
||||
default property alias content: container.data
|
||||
property int launchMode: FluWindow.Standard
|
||||
property string route
|
||||
property var argument:({})
|
||||
property var pageRegister
|
||||
signal initArgument(var argument)
|
||||
|
||||
id:window
|
||||
background: Rectangle{
|
||||
color: {
|
||||
if(active){
|
||||
|
Loading…
Reference in New Issue
Block a user