내 응용 프로그램에는 homepage.qml로 이동하는 main.qml이 있으며 거기에서 profilepage.qml로 이동합니다. 프로필 페이지에서 홈페이지로 돌아올 때 홈 페이지에서 기능을 트리거해야합니다. 내가 팝업 할 때마다 메인 페이지에서 onPopTransitionEnded 호출을 받는다는 것을 알아 챘다. 홈페이지는 main.qml에서 푸시되었으므로 홈페이지에는 탐색 창이 없으므로 홈페이지에서 onPopTransitionEnded에 액세스 할 수 없습니다. 아래는 3QML 뷰의 샘플 구조입니다.qml을 사용하여 블랙 베리 캐스케이드의 다른 페이지에서 한 페이지의 기능 호출
main.qml
NavigationPane {
id: nav
peekEnabled: false
onPopTransitionEnded: {
console.log("POP PAGE from main");
if(page.objectName=="newProfilePage")
{
//I tried to access the function using the homepage id but didnt work
menuScreenPage.reloadView(); // This doesnt work, shows error unknown symbol menuScreenPage
}
page.destroy();
}
Page {
id: mainPage
Container {
//some code
}
onCreationCompleted: {
//Some code and then push to homepage
nav.push(homePageDefenition.createObject());
}
}
}
homepage.qml
Page {
id: menuScreenPage
objectName: "menuScreenPage"
function reloadView() //This is the function that is needed to be called on page pop from profile page
{
//some code
}
Container {
//some code
Button { //a button to push to profile page
id:pushButton
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Bottom
onClicked: {
console.log("I was clicked!")
nav.push(profilePageDefinition.createObject());
}
}
}
}
profilepage.qml
Page {
id: newProfilePage
objectName: "newProfilePage"
Container {
//some code
Button { //a button to pop to home page
id:popButton
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Bottom
onClicked: {
console.log("I was clicked!")
nav.pop();
}
}
}
}
그래서 내가 거기로부터 homepage.qml의 기능에 액세스 할 수있는 방법 main.qml? 아니면 profilepage에서 팝 때 homepage.qml 자체에 액세스 할 수 onPopTransitionEnded 같은 다른 함수가 있습니까? 제발 조언.
나는 reloadView을 (에 액세스 할 수 있습니다) 어디서나 homepage.qml에서하지만 난 main.qml에서 접근 할 필요가있다. 또는 홈페이지에 프로필 페이지가 팝업되었음을 직접 알리는 다른 방법이 있습니다. – Gamerlegend
문제는 "reloadView()"기능이 아니라 홈페이지 자체에 액세스 할 수 없다는 것입니다. 내 사례를 살펴보십시오. 특수한 속성 인 "myHomePage"가 하위 페이지에 액세스하는 데 사용됩니다. 시도 해봐. – QtRoS
괜찮 았지만 내 질문은 내가 어디에서 부를까요? 내가 profilepage에 있다고 가정하고 뒤로 버튼을 클릭하면 나를 홈페이지로 데려 갈 것이고, 다시 홈페이지로 돌아올 때 다시 불러올 필요가있다. onCreationComplete와 같은 다른 메소드가 있는데, 다시 팝업되는 동안 호출됩니다. 메인 페이지에서만 onPopTransitionEnded에 액세스 할 수 있도록 내 탐색 창이 main.qml에 있음을 유의하거나 홈페이지에서 onPopTransitionEnded에 액세스 할 수있는 다른 방법이 있습니까? – Gamerlegend