Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating QImage from a QML component?

Creating QImage from a QML component?

Scheduled Pinned Locked Moved Solved General and Desktop
libopenshotqpainter
3 Posts 2 Posters 536 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
    Wiru
    wrote on 28 Aug 2020, 02:34 last edited by
    #1

    I'm wondering if it's possible to convert QML components to a QImage type, or something similar.

    To be exact, I'm thinking about a Rectangle and a ProgressBar, since they are visual components, in theory it should be possible to convert them to something like a QImage?

    What I'm trying to do is using libopenshot, burn one of the components on to the video as an overlay, but for that I need them in a format it can recognize, and a QImage seems closes to it.

    My idea is to create a subclass of each component and draw it to the user in QML, while having the object reference so it can be added to the video. But I'm not sure of how to make it work.

    Would a QPainter be able to do the trick, or a QQuickPaintedItem? Handing the object (QGraphicsItem?) to it and draw/"convert" it?

    Since I never done something of that sort, I'm a bit stuck at what are the possible options for the solution.

    Any help is highly appreciated.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 28 Aug 2020, 05:01 last edited by
      #2

      You can use Item's grabToImage method.

      (Z(:^

      1 Reply Last reply
      3
      • W Offline
        W Offline
        Wiru
        wrote on 28 Aug 2020, 09:32 last edited by
        #3

        Thank you, I think this will do just perfect!

        1 Reply Last reply
        0

        1/3

        28 Aug 2020, 02:34

        • Login

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