Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QQuickImageProvider not recieving Unicode from Qml - cannot find image
Forum Update on Monday, May 27th 2025

QQuickImageProvider not recieving Unicode from Qml - cannot find image

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 487 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T_Eng
    wrote on 8 Mar 2017, 07:42 last edited by
    #1

    Hi,
    I am building an application with a QML image source that is set from C++ backend. My problem being the QQuickImageProvider I have attached to my application engine as an image provider takes in the image source data as a QString in the requestPixmap function - using the example provided in QQuickImageProvider doc

    class ColorImageProvider : public QQuickImageProvider
    {
    public:
        ColorImageProvider()
            : QQuickImageProvider(QQuickImageProvider::Pixmap)
        {
        }
    
        QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
        {
            int width = 100;
            int height = 50;
    
            if (size)
                *size = QSize(width, height);
            QPixmap pixmap(requestedSize.width() > 0 ? requestedSize.width() : width,
                           requestedSize.height() > 0 ? requestedSize.height() : height);
            pixmap.fill(QColor(id).rgba());
    
            return pixmap;
        }
    };
    

    How can I ensure the Unicode string properly propagates from C++ backend to QML back to QQuickImageProvider::requestPixmap()?

    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 8 Mar 2017, 08:10 last edited by
      #2

      Hi,

      Can you show how you are using your provider in your code ? As well as an example of string ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      8 Mar 2017, 07:42

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved