qtfilterqmlqt-mobility

Filtering with QML Document Gallery (Qt Mobility)


I want to filter albums for only one artist, but nothing is shown.

My code is:

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
        }
    }
}

When I select an artist in SelectArtistPage another page opens, no buttons with albums names are painted. If I remove the filter all the albums are shown.

What am I doing wrong? I'm using Qt Mobility 1.2 package for Maemo (I'm testing on N900).


Solution

  • It seems to be a bug in Maemo Qt Mobility, as I wrote here: http://talk.maemo.org/showpost.php?p=1254495&postcount=112