在N9使用TabGround进行页面导航(01)
2014-10-12 09:16
309 查看
在为N9开发应用时,页面导航成为初学者最为头疼的事情。
下面我为大家介绍一下TabFGround的页面导航。
先上效果图
将一个ToolBar置顶,ToolBar里存放着三个Tab按钮
ToolBar下方有个TabGround,存放着三个Page
参考《《某文章》》进行创建一个N9的qtquick工程
/*main.qml*/
/*TestPage.qml*/
现在解释下上述代码
在TestPage.qml文件中,我们使用PageStack作为顶级控件,在main.qml中使用PageStackWindow来管理PageStack。
在TestPage.qml文件中,我们使用ToolBar的tools来装载一个ToolBarLayout,ToolBarLayout中使用ButtonRow来布三个TabButton。然后我们将ToolBar的錨(anchor)对齐parent的top。
TabGround的top对齐ToolBar的bottom。
在TabGround有三个Page,他们是TabGround的子项目。
在三个TabButton中,有个tab属性,这里填写TabGround中对应三个Page的id。
每点击TabButton,都会让TabGround的currentTab变更为对应的Page。
注:TabGround中的currentTab属性,存放的是当前TabGround显示的控件的id。
下面我为大家介绍一下TabFGround的页面导航。
先上效果图
将一个ToolBar置顶,ToolBar里存放着三个Tab按钮
ToolBar下方有个TabGround,存放着三个Page
参考《《某文章》》进行创建一个N9的qtquick工程
/*main.qml*/
import QtQuick 1.1 import com.nokia.meego 1.0 PageStackWindow { id: appWindow showStatusBar:false initialPage:test TestPage { id:test } }
/*TestPage.qml*/
import QtQuick 1.1 import com.nokia.meego 1.0 PageStack { ToolBar { id: topToolBar anchors { left: parent.left; right: parent.right; top: parent.top } tools: ToolBarLayout { id: tabBarLayout anchors { left: parent.left; right: parent.right; } ButtonRow { TabButton { tab: tab1; text: qsTr("Tab 1") } TabButton { tab: tab2; text: qsTr("Tab 2") } TabButton { tab: tab3; text: qsTr("Tab 3") } } } } TabGroup { id: tabGroup currentTab: tab1 anchors.top: topToolBar.bottom Page { id: tab1 Text { text: "This is a single page1" } } Page { id: tab2 Text { text: "This is a single page2" } } Page { id: tab3 Text { text: "This is a single page3" } } } }
现在解释下上述代码
在TestPage.qml文件中,我们使用PageStack作为顶级控件,在main.qml中使用PageStackWindow来管理PageStack。
在TestPage.qml文件中,我们使用ToolBar的tools来装载一个ToolBarLayout,ToolBarLayout中使用ButtonRow来布三个TabButton。然后我们将ToolBar的錨(anchor)对齐parent的top。
TabGround的top对齐ToolBar的bottom。
在TabGround有三个Page,他们是TabGround的子项目。
在三个TabButton中,有个tab属性,这里填写TabGround中对应三个Page的id。
每点击TabButton,都会让TabGround的currentTab变更为对应的Page。
注:TabGround中的currentTab属性,存放的是当前TabGround显示的控件的id。
相关文章推荐
- 在N9使用TabGround进行页面导航(02)
- iOS开发使用Tab Bar Controller实现页面导航功能
- react-native使用react-navigation进行页面跳转导航
- react-native使用react-navigation进行页面跳转导航的示例
- ReactNative基础(六)使用react-navigation实现页面导航布局效果(TabNavigator)
- ASP.NET 2.0中使用sitemapdatasource页面导航控件
- 如何在单击WEB控件引发页面刷新时定位页面?(不使用智能导航)
- 在Frame的子页面中进行导航
- 使用css在不同页面上使用同样的导航代码
- asp.net 2.0中使用sitemapDATAsource做页面导航
- 在使用ASP.NET时进行页面重定向的3种方法。(转)
- 在HttpModule中使用gzip,deflate协议对aspx页面进行压缩
- asp.net 2.0中使用sitemapDATAsource做页面导航
- 使用Grid来对WPF页面进行布局排版
- 使用Grid来对WPF页面进行布局排版
- 使用框架集实现页面导航功能
- 使用JSTL进行页面服务器端校验
- 使用TIdHTTP控件进行页面访问
- 使用ASP.NET AJAX异步调用Web Service和页面中的类方法(4):异步通讯层生成的客户端代理类、使用HTTP GET进行调用
- 在ASP.NET 2.0中使用页面导航控件