main
zhuzihcu 2023-05-10 10:32:37 +08:00
parent 9c843a7157
commit 7d5fcc6e47
4 changed files with 28 additions and 21 deletions

View File

@ -35,6 +35,12 @@ FluWindow {
FluText{
text:"FluentUI"
font: FluTextStyle.Title
MouseArea{
anchors.fill: parent
onClicked: {
FluApp.navigate("/")
}
}
}
FluText{
text:"v%1".arg(appInfo.version)

View File

@ -15,6 +15,7 @@ FluWindow {
closeDestory:false
minimumWidth: 520
minimumHeight: 460
launchMode: FluWindow.SingleTask
closeFunc:function(event){
close_app.open()

View File

@ -91,29 +91,28 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
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->setProperty("argument",argument);
pair->show();
pair->raise();
pair->requestActivate();
view->deleteLater();
return;
}
}
}else if(launchMode==2){
for (auto& pair : wnds) {
QString r = pair->property("route").toString();
if(r == route){
pair->close();
break;
}
QQuickWindow *view=nullptr;
for (auto& pair : wnds) {
QString r = pair->property("route").toString();
if(r == route){
view = pair;
break;
}
}
if(view){
//如果窗口存在,则判断启动模式
int launchMode = view->property("launchMode").toInt();
if(launchMode == 1){
view->setProperty("argument",argument);
view->show();
view->raise();
view->requestActivate();
return;
}else if(launchMode == 2){
view->close();
}
}
view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
if(fluTheme->frameless()){
view->setFlag(Qt::FramelessWindowHint,true);
}

View File

@ -210,6 +210,7 @@ Item {
id:item_mouse
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.NoButton
}
FluTooltip{