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. Save single Item as image
Forum Updated to NodeBB v4.3 + New Features

Save single Item as image

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • E Offline
    E Offline
    epicfailguy93
    wrote on last edited by
    #1

    I need a way to save Item's texture as a png file. I was trying to understand, but it was not easy. You can simply save the contents of the entire window, not a separate Item. I tried to make a transparent window background and display a single item necessary to me. In this case when you save the image, background turns black.

    I also tried:
    layer.format: ShaderEffectSource.Alpha - nothing has changed
    get the texture from QQuickItem::textureProvider()::texture() - textureProvider() always returns 0

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      Why do you want to save the texture of a QQuickItem in the first place? Unlike with QWidgets, there is no way to "grab" the contents of a scene graph for a specific item. Getting the texture will just return the original image without shader effects or child items applied so you might as well just use the original image source you set on the Image. Perhaps you should rather make a separate window of your scene and grab that instead?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        epicfailguy93
        wrote on last edited by
        #3

        [quote author="Jens" date="1361265251"]Perhaps you should rather make a separate window of your scene and grab that instead?[/quote]

        [quote author="epicfailguy93" date="1361229673"]I tried to make a transparent window background and display a single item necessary to me. In this case when you save the image, background turns black.[/quote]

        Previously, I used the text overlaid shader to glow, but for better performance, I decided to replace all the text on the image. Such a soft glow can not be obtained using Photoshop, so I decided to find a way to save the contents of the ShaderEffectItem. So, is it possible?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          capisce
          wrote on last edited by
          #4

          bq. get the texture from QQuickItem::textureProvider()::texture() – textureProvider() always returns 0

          Did you do "layer.enabled: true" on the item on the QML side? Otherwise as you note it won't have a texture.

          Make sure to only access the texture from the scene graph thread though, by connecting with a DirectConnection to QQuickView::afterRendering() (defined in QQuickWindow).

          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