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{ FluText{
text:"FluentUI" text:"FluentUI"
font: FluTextStyle.Title font: FluTextStyle.Title
MouseArea{
anchors.fill: parent
onClicked: {
FluApp.navigate("/")
}
}
} }
FluText{ FluText{
text:"v%1".arg(appInfo.version) text:"v%1".arg(appInfo.version)

View File

@ -15,6 +15,7 @@ FluWindow {
closeDestory:false closeDestory:false
minimumWidth: 520 minimumWidth: 520
minimumHeight: 460 minimumHeight: 460
launchMode: FluWindow.SingleTask
closeFunc:function(event){ closeFunc:function(event){
close_app.open() 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("pageRegister",QVariant::fromValue(fluRegister));
} }
properties.insert("argument",argument); properties.insert("argument",argument);
QQuickWindow *view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties)); QQuickWindow *view=nullptr;
int launchMode = view->property("launchMode").toInt();
if(launchMode==1){
for (auto& pair : wnds) { for (auto& pair : wnds) {
QString r = pair->property("route").toString(); QString r = pair->property("route").toString();
if(r == route){ if(r == route){
pair->setProperty("argument",argument); view = pair;
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; 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()){ if(fluTheme->frameless()){
view->setFlag(Qt::FramelessWindowHint,true); view->setFlag(Qt::FramelessWindowHint,true);
} }

View File

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