×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    22

    Question QGalleryQueryModel and filters (QGalleryFilter, QGalleryMetaDataFilter and *Union*)

    Hi,

    I have a class:
    Code:
    class Model : public QGalleryQueryModel
    {
        Q_OBJECT
    public:
        explicit Model(QAbstractGallery* gallery,  QObject *parent = 0);
        virtual ~Model ();
    };
    And a constructor:
    Code:
    Model::Model(QAbstractGallery* gallery, QObject *parent):QGalleryQueryModel(gallery,parent)
    {
        setRootType(QDocumentGallery::File);
    
        QHash<int, QByteArray> properties;
        properties.insert(Qt::UserRole + 1, "url");
        properties.insert(Qt::UserRole + 2, "fileName");
        setRoleNames(properties);
    
        QHash<int, QString> columns;
        columns.insert(Qt::UserRole + 1, "url");
        columns.insert(Qt::UserRole + 2, "fileName");
        addColumn(columns);
    
        execute();
    }
    which works fine, in my E7 (Belle) it lists lots of files. I am using the model in QML. But when I add filters to it:

    Code:
    Model::Model(QAbstractGallery* gallery, QObject *parent):QGalleryQueryModel(gallery,parent)
    {
        setRootType(QDocumentGallery::File);
    
        QHash<int, QByteArray> properties;
        properties.insert(Qt::UserRole + 1, "url");
        properties.insert(Qt::UserRole + 2, "fileName");
        setRoleNames(properties);
    
        QHash<int, QString> columns;
        columns.insert(Qt::UserRole + 1, "url");
        columns.insert(Qt::UserRole + 2, "fileName");
        addColumn(columns);
    
        ufilterP_=new QGalleryUnionFilter();
        m1filterP_=new QGalleryMetaDataFilter("fileName", "wav", QGalleryFilter::Contains);
        m2filterP_=new QGalleryMetaDataFilter("url", "mp4", QGalleryFilter::EndsWith);
        m3filterP_=new QGalleryMetaDataFilter("url", "*.mp3", QGalleryFilter::Wildcard);
        ufilterP_->append(*m1filterP_);
        ufilterP_->append(*m2filterP_);
        ufilterP_->append(*m3filterP_);
        filterP_=new QGalleryFilter(*ufilterP_);
        setFilter(*filterP_);
    
        execute();
    }
    not a single file is found. I have tried the code with one filter only and as you can see, with different comparators and both properties.

    Any idea what could be wrong? Earlier I saw someone mentioning on some filters not working properly in Symbian but can not find the web page now. Is there a bug in the filters? Or am I using it somehow wrong? Any workaround? I had similar problem with filters when implementing also the model in QML.

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: QGalleryQueryModel and filters (QGalleryFilter, QGalleryMetaDataFilter and *Union

    Hi,

    Did you try using just one filter and see if the files are listed..
    ufilterP_=new QGalleryUnionFilter();
    m1filterP_=new QGalleryMetaDataFilter("fileName", "wav", QGalleryFilter::Contains);
    ufilterP_->append(*m1filterP_);
    filterP_=new QGalleryFilter(*ufilterP_);
    setFilter(*filterP_);

    i mean with just these lines.. or just one metadatafilter..

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    22

    Re: QGalleryQueryModel and filters (QGalleryFilter, QGalleryMetaDataFilter and *Union

    Quote Originally Posted by kusumk View Post
    Did you try using just one filter and see if the files are listed..
    Yes. (I am not sure if it was exactly those lines but I tried various ways with as stripped out code as possible). No success. I have now chosen another path to handle the issue ...

Similar Threads

  1. QGalleryQueryModel returns empty
    By web_tur in forum [Archived] Qt Mobility Project
    Replies: 4
    Last Post: 2012-04-10, 07:55
  2. How can I use QGalleryMetaDataFilter?
    By mismael in forum [Archived] Qt Mobility Project
    Replies: 2
    Last Post: 2011-07-11, 10:03
  3. adaiptive filters
    By vladest in forum Qt
    Replies: 1
    Last Post: 2011-07-04, 11:58
  4. How to use QGalleryQueryModel with QML?
    By mismael in forum [Archived] Qt Mobility Project
    Replies: 2
    Last Post: 2011-05-14, 22:37
  5. How to set SMS filters
    By leejx in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2009-09-02, 05:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •