想用TABVIEW为下面的每个
按钮做不同的
图片,在TAB中增加了一个属性string型用来存放背景图片,结果不论是string 或者 url 都不行,报错
qrc:/main.qml:77:20: Unable to assign [undefined] to QUrlqrc:/main.qml:77:20: Unable to assign [undefined] to QUrlqrc:/main.qml:77:20: Unable to assign [undefined] to QUrlqrc:/main.qml:77:20: Unable to assign [undefined] to QUrlqrc:/main.qml:77:20: Unable to assign [undefined] to QUrl
TabPlus如下
import QtQuick
2.0
import QtQuick.Controls 1.3
Tab{
property string tabpressed
}
main中如下
import QtQuick
2.4
import QtQuick.Controls
1.3
import QtQuick.Controls.Styles
1.1
ApplicationWindow {
title:
qsTr(
"Hello World")
width:
640
height:
480
visible:
true
TabView{
tabPosition:
Qt.BottomEdge
anchors.fill:
parent
anchors.centerIn:
parent
style:
styletab
TabPlus{
title:
"view1"
Page1{
visible:
true
}
tabpressed:"images/tab_selected.png" }
TabPlus{
title:
"view2"
Page2{
visible:
true
}
tabpressed:"images/button_default.png"
}
TabPlus{
title:
"view3"
Page3{
visible:
true
}
tabpressed:"images/tab_selected.png"
}
TabPlus{
title:
"view3"
Page4{
visible:
true
}
tabpressed:"images/tab_selected.png"
}
}
Component{
id:
styletab
TabViewStyle{
tabsAlignment:
Qt.AlignHCenter
tabOverlap:
0
tab:
Item{
implicitWidth:control.width/control.count
implicitHeight:50
BorderImage {
anchors.fill:
parent
source :styleData.tabpressed border.top:
8
border.bottom:
8
Text{
anchors.centerIn:
parent
color:
styleData.selected
?
"white":
"blue"
text:
styleData.title
font.pixelSize:
16
}
}
}
}
}
}
不知道为什么这样,希望指点一下如何更改