我想只过滤一个艺术家的相册,但什么都没有显示。
我的代码是:
SelectArtistPage.qml:
import QtQuick 1.1
import com.nokia.meego 1.0
import QtMobility.gallery 1.1
Page
{
id: selectArtistPage
tools: backtoolbar
property string selectedartist
ListView
{
id: galleryView
anchors.fill: parent
clip: true
model: artistModel
delegate: Item
{
height: 60
width: parent.width
Button
{
height: 50
width: parent.width - 20
text: (artist != "") ? artist : "(unknown artist)"
onClicked:
{
selectedartist = (text != "(unknown artist)") ? text : ""
selectAlbumPageLoader.source = "SelectAlbumPage.qml"
pageStack.push(selectAlbumPageLoader.item)
}
}
}
}
DocumentGalleryModel
{
id: artistModel
rootType: DocumentGallery.Artist
properties: ["artist"]
}
}SelectAlbumPage.qml:
import QtQuick 1.1
import com.nokia.meego 1.0
import QtMobility.gallery 1.1
Page
{
id: selectAlbumPage
tools: backtoolbar
property string selectedalbum
ListView
{
id: galleryView
anchors.fill: parent
clip: true
model: albumModel
delegate: Item
{
height: 60
width: parent.width
Button
{
height: 50
width: parent.width - 20
text: (albumTitle != "") ? albumTitle : "(unknown album)"
onClicked:
{
selectedalbum = (text != "(unknown album)") ? text : ""
// here should be launching the last page
}
}
}
}
DocumentGalleryModel
{
id: albumModel
rootType: DocumentGallery.Album
properties: ["albumTitle", "artist"]
filter: GalleryEqualsFilter
{
property: "artist"
value: selectedartist
}
}
}当我在SelectArtistPage中选择一位艺术家时,另一个页面打开,没有任何带有专辑名称的按钮被绘制。如果我移除过滤器,所有的相册都会显示出来。
我做错了什么?我正在为Maemo使用Qt Mobility1.2包(我在N900上测试)。
发布于 2012-08-31 20:45:48
这似乎是Maemo Qt Mobility中的一个bug,正如我在这里所写的:http://talk.maemo.org/showpost.php?p=1254495&postcount=112
https://stackoverflow.com/questions/11577749
复制相似问题