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. Create images with QML
QtWS25 Last Chance

Create images with QML

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 6 Posters 5.7k 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.
  • S Offline
    S Offline
    sfabry
    wrote on last edited by
    #1

    Hello,

    I have a simple pixmap to design and was wondering if I could do it in QtCreator with the QML editor, I only need rectangle with some text and colors.

    But I have to save it to image file, let's say png. Is it possible to somewhat export the qml rendering and save as image ?

    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexander
      wrote on last edited by
      #2

      You can do it in C++.
      @QGraphicsView::render@

      1 Reply Last reply
      0
      • M Offline
        M Offline
        minimoog77
        wrote on last edited by
        #3

        You can use qmlviewer to save rendering to png.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Aleskey78
          wrote on last edited by
          #4

          This may be helpful:
          "How to save an image from QML Image element?":http://developer.qt.nokia.com/forums/viewthread/3948

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sfabry
            wrote on last edited by
            #5

            [quote author="minimoog77" date="1303902570"]You can use qmlviewer to save rendering to png.[/quote]

            Would be what I search for but can't find how to do this with qmlviewer... The only option I see is "recording" -> "take a snapshot (F3)" but even with this I can't get nor save the image of the snapshot.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Aleskey78
              wrote on last edited by
              #6

              [quote author="ness522" date="1303914947"]
              Would be what I search for but can't find how to do this with qmlviewer... The only option I see is "recording" -> "take a snapshot (F3)" but even with this I can't get nor save the image of the snapshot.
              [/quote]

              The snapshot will be saved as "snapshot1.png" in the same folder with your qml-file.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sfabry
                wrote on last edited by
                #7

                Precision : The snapshot file is created in the directory where you start qmlviewer.

                Thanks all.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  Of course, any screenshot-taking app would have sufficed for this.

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sfabry
                    wrote on last edited by
                    #9

                    Of course, things are not always so simple, I have some transparent areas that needs to remain transparent in the image export.

                    But this transparency doesn't work with the snapshot feature of qmlviewer...

                    I'm trying to use qml in place of gimp or photoshot for a simple design

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mlong
                      wrote on last edited by
                      #10

                      That does add another layer of difficulty. Probably should have mentioned that requirement earlier on. Could you mask out the transparent area with a neutral color, perhaps, and remove it later on using GIMP or Photoshop? Or are you looking for partial transparency?

                      Software Engineer
                      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                      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