2013-01-23 1 views
2

아래 TabbedPane을 정의했지만 각 탭마다 하나의 파일에 코드를 포함하는 대신 "questions.qml"(탐색 창 ") 및"stats.qml "내용을 표시하고 싶습니다. ?다른 qml 파일에 정의 된 TabbedPane에 페이지 또는 탐색 창을 연결하는 방법?

import "UI" // The file DataManagement.qml is located in the directory UI 
      // which is a sub-directory of the location of this QML file. 
... 
Tab { 
    title: qsTr("Data Management") 
    imageSource: "asset:///images/icons/database.png" 
    id: dataManagement 
    DataManagement { 
     id: dataManagementPage 
    } 
} 
... 

을 그 다음에 : 나는 그것을 달성 할 수있는 방법 궁금하면 내가 그 경우에 무슨 짓을

TabbedPane { 
    showTabsOnActionBar: true 
    Tab { 
     id: questions 
     title: "Questions" 
     description: "This tab will have questions in current hub" 
    } 
    Tab { 
     id: stats 
     title: "Stats" 
    } 
} 

답변

3

당신이 가지고있는, 세트 업을 탭 구획을 파일 QML에서 각 탭을 선언하다 별도의 QML 파일 인 DataManagement.qml을 탭의 내용으로 선언합니다.

import bb.cascades 1.0 

Page { 
    // content of page to render in the tab. 
    content: Container { 
     ... 
    } 
} 

QML 파일이 인 같은 디렉토리에 있거나 참조 된 파일 (DataManagement.qml)이 첫 번째 QML 파일에 포함 된 디렉토리에 있으면 작동합니다.

+0

감사합니다. 그 일. 그러나 파일이 다른 디렉토리에 있다면? 이 경우 어떻게해야합니까? – itsaboutcode

+0

그 또한 쉽습니다. 내 사용자 인터페이스 QML 파일을 assets/UI 디렉토리에 넣었습니다. 그래서 main.qml 파일에 "UI"라는 줄 가져 오기를 포함 시켜서 이것을 대답으로 편집했습니다. – Richard

+0

Richard에게 감사드립니다. 정말 도움이됩니다. – itsaboutcode