//tab切换
TabView
{
id:tabView;
anchors.fill: parent;
tabPosition: Qt.BottomEdge;
clip: true
onCurrentIndexChanged:
{
switch(currentIndex)
{
case 0:
console.debug("tab1")
tab1.item.initData();
break;
case 1:
console.debug("tab2")
tab2.item.initData();
break;
}
}
Tab
{
id:tab1
title: "tab1";
source: "qrc:/11.qml"
}
Tab
{
id:tab2
title: "tab2";
source: "qrc:/22.qml";
}
style: TabViewStyle
{
tabsAlignment: Qt.AlignHCenter;
tabOverlap: 0;
tab: Rectangle
{
implicitWidth: tabView.width/2;
implicitHeight: text.contentHeight * 2 + 6 * pixelRate;
color: styleData.selected? "#016469" : "#0E0E0E";
NSText
{
id: text
anchors.centerIn: parent
text: styleData.title
color: styleData.selected? "#0DDBA9" : "#FFFFFF";
}
Image
{
id: topRec;
visible: styleData.selected;
source: "qrc:/img/resource/img/home/indicator.png";
width: 10*pixelRate;
height: 10*pixelRate;
anchors
{
horizontalCenter: parent.horizontalCenter;
top: parent.top;
}
}
}
frame:Rectangle{color: "white";}
}
}