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 for RichText <img src=image://imageprovider ...>
Forum Updated to NodeBB v4.3 + New Features

QQuickImageProvider for RichText <img src=image://imageprovider ...>

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 278 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.
  • W Offline
    W Offline
    Witzgy
    wrote on last edited by Witzgy
    #1

    Dear Qt community,

    In Qt 5.15.1 I would like to represent an image within a text component using a QQuickImageProvider as follows

    Text {
        textFormat: Text.RichText
        text: "This is a red box: <img src='image://colors/red' width='60' height='60'>"
    }
    

    As long as the textFormat equals Text.StyledText everything works fine.
    But as soon as the textFormat changes to Text.RichText the values for width and height are not passed to the image provider's requestImage() method anymore: requestedSize:(-1,-1)

    Is there a way to pass the requested image dimensions to the image provider?

    eyllanescE 1 Reply Last reply
    0
    • W Witzgy

      Dear Qt community,

      In Qt 5.15.1 I would like to represent an image within a text component using a QQuickImageProvider as follows

      Text {
          textFormat: Text.RichText
          text: "This is a red box: <img src='image://colors/red' width='60' height='60'>"
      }
      

      As long as the textFormat equals Text.StyledText everything works fine.
      But as soon as the textFormat changes to Text.RichText the values for width and height are not passed to the image provider's requestImage() method anymore: requestedSize:(-1,-1)

      Is there a way to pass the requested image dimensions to the image provider?

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @Witzgy A workaround could be to pass the size through the url, something like image://colors/red?width=60&height=60, and in the provider obtain the size of the "id".

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0

      • Login

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