我想在用戶點擊應用程序圖標時顯示一個啓動頁面。爲此,我創建了工作表並將其附加到頁面上。 main.qml如何在qml中關閉表單?
import bb.cascades 1.0
Page {
Container {
Label {
text: "Home page"
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
}
}
attachedObjects: [
Sheet {
id: mySheet
content: Page {
Label {
text: "Splash Page/Sheet."
}
}
}
]//end of attached objects
onCreationCompleted: {
//open the sheet
mySheet.open();
//After that doing some task here.
---------
---------
---------
//Now I'm closing the Sheet. But the Sheet was not closed.
//It is showing the Sheet/Splash Page only, not the Home Page
mySheet.close();
}
}//end of page
工作完成後,我想關閉表。所以我調用了close()方法。但是Sheet沒有關閉。
如何關閉oncreationCompleted()方法或任何C++方法中的工作表?
您是否嘗試在mySheet.close()之前/之後放置一個日誌,只是爲了確保達到它? –
是的,我測試過了,它也打印日誌消息。 – user2636874
您的任務需要多長時間?當您嘗試關閉它時,可能表單尚未完全打開(動畫可能未結束)。 –