×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    28

    c++ model for ListView question

    Hi,

    I implemented standard solution with QAbstractListModel derived class used as a model for qml ListView, it works great. Next step is to separate model from actual data a bit, instead of returning QVariant<QString> ( for example ) from data function I want to return my custom type like this: QVariant<MyType>... then in qml in delegate I want to use it, for example:
    Code:
    // assuming there is data model role named myrole, model data function is returning QVariant<MyType>
    Image
      {
      source: myrole.filename()
    }

    Unfortunately such construction does not work, in application output window there is a message that myrole.filename() is undefined, the same happens when MyType has property filename and in qml it is used like "source: myrole.filename". However is there is just " source: myrole" then there is a message "cannot convert MyType to QUrl" which seems to be true

    How I should proceed with that? Is such approach possible at all?

    Thanks in advance

    seba

    PS What about pointers, my idea is to return QVariant<MyType*> and actually return a pointer to derived type and then in qml check what type actually is and construct logic basing on that
    Last edited by sebaw; 2011-09-16 at 12:05.

Similar Threads

  1. Active Objects, Programming model question
    By indeewari in forum Symbian
    Replies: 19
    Last Post: 2010-08-22, 05:02
  2. question about Symbian moving memory model.
    By frydsh in forum Symbian
    Replies: 4
    Last Post: 2010-01-12, 19:11
  3. Contact Model code question
    By Larry101 in forum Symbian
    Replies: 0
    Last Post: 2006-06-27, 09:59
  4. Cell Phone Model Question
    By kensiu_fp in forum Mobile Java General
    Replies: 3
    Last Post: 2005-12-30, 10:18
  5. newbie question, which SDK to use for J2ME on 6820 model
    By sacg in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2005-01-05, 06:27

Posting Permissions

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