×

Discussion Board

Results 1 to 7 of 7

Threaded View

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    105

    Post QT QDeclarativeImageProvider child class single instance?

    Hi,
    has someone else seen this?
    I have a

    class QMyImgProvClass : public QDeclarativeImageProvider{
    ..
    virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize){
    ...
    }
    QMyImgProvClass * instance(){
    static QMyImgProvClass s_myClass;
    return &s_myClass;
    }
    public:
    QList<int> m_list;
    };

    Since I need to use this in a plugin, I register it in the

    void BookmarkModelPluginPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri){
    engine->addImageProvider(QLatin1String(MY_IMGPROV_NAME), QMyImgProvClass::Instance());
    }

    through a simple Singleton.

    In the plugin then, I populate the m_list;
    .
    Now, the requestImage is called correctly from QML. BUT, the effect is that the m_list list is EMPTY for each call. It seems that for each call to the requestImage, the "this" pointer is different.

    I thought the addImageProvider registers a single object as an image provider?
    Last edited by tkastlunger; 2012-08-24 at 07:03.

Similar Threads

  1. Single instance (Meego harmattan)
    By kompotFX in forum Nokia N9
    Replies: 2
    Last Post: 2011-08-11, 08:44
  2. Single instance of process...
    By pornima in forum Symbian
    Replies: 6
    Last Post: 2009-08-26, 14:47
  3. Replies: 4
    Last Post: 2009-02-17, 05:47
  4. Replies: 6
    Last Post: 2007-03-14, 12:56

Posting Permissions

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