首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用QML文档库进行筛选(Qt Mobility)

使用QML文档库进行筛选(Qt Mobility)
EN

Stack Overflow用户
提问于 2012-07-20 18:44:23
回答 1查看 454关注 0票数 0

我想只过滤一个艺术家的相册,但什么都没有显示。

我的代码是:

SelectArtistPage.qml:

代码语言:javascript
复制
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:

代码语言:javascript
复制
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上测试)。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-31 20:45:48

这似乎是Maemo Qt Mobility中的一个bug,正如我在这里所写的:http://talk.maemo.org/showpost.php?p=1254495&postcount=112

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11577749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档