Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to get a screenshot in Android?
Forum Updated to NodeBB v4.3 + New Features

How to get a screenshot in Android?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
29 Posts 3 Posters 3.4k Views 2 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #11

    is the image valid then ?
    like
    qDebug() << image.isNull();
    says false ?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mikeeeeee
      wrote on last edited by Mikeeeeee
      #12

      qDebug()<<"screenShot:"<<image;
      return:
      "screenShot: "data:image/png;base64,""

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mikeeeeee
        wrote on last edited by
        #13

        @mrjj said in How to get a screenshot in Android?:

        qDebug() << image.isNull();

        qDebug() <<"image.isNull() :" << image.isNull();
        return:
        image.isNull() : false

        mrjjM 1 Reply Last reply
        0
        • M Mikeeeeee

          @mrjj said in How to get a screenshot in Android?:

          qDebug() << image.isNull();

          qDebug() <<"image.isNull() :" << image.isNull();
          return:
          image.isNull() : false

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #14

          @mikeeeeee
          Ok, that means its does grab something :)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mikeeeeee
            wrote on last edited by
            #15

            But how to get a picture out of it?

            mrjjM 1 Reply Last reply
            0
            • M Mikeeeeee

              But how to get a picture out of it?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #16

              @mikeeeeee
              Cant you just save it ?
              https://doc.qt.io/qt-5/qimage.html#save

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on last edited by
                #17

                We've made a mistake. I immediately ask the text QString image("data:image/png;base64,"); And so, pictures of the there is no. Need another code.

                mrjjM 1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Mikeeeeee
                  wrote on last edited by
                  #18

                  qDebug() <<"image.isNull() :" << image.isNull()<<"screen->size() :"<<screen->size();
                  return
                  image.isNull() : false screen->size() : QSize(360, 640)

                  1 Reply Last reply
                  0
                  • M Mikeeeeee

                    We've made a mistake. I immediately ask the text QString image("data:image/png;base64,"); And so, pictures of the there is no. Need another code.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #19

                    @mikeeeeee
                    Im really not sure what you are saying. :)
                    That code work for others it seemed
                    https://stackoverflow.com/questions/21697185/how-to-take-screenshot-of-qml-application-without-qquickview/38501975

                    What Qt version are you using?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Mikeeeeee
                      wrote on last edited by
                      #20

                      Could the screen be incorrectly processed?

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mikeeeeee
                        wrote on last edited by
                        #21

                        I use Qt 5.13

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          Mikeeeeee
                          wrote on last edited by
                          #22

                          my initial code worked in Windows, but it doesn't work in Android.

                          mrjjM 1 Reply Last reply
                          0
                          • M Mikeeeeee

                            my initial code worked in Windows, but it doesn't work in Android.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #23

                            @mikeeeeee
                            Hi
                            Not all android devices can take shot of QML. Need support in openGL driver.

                            Hmm. your Qt version seems new enough.
                            if you google "qt qml grabwindow bug" you can see there been quite some issues but
                            it should work with new Qt versions.

                            How type of android device are you using ? I mena is it old or kinda new ?

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Mikeeeeee
                              wrote on last edited by
                              #24

                              I use Android 5,6,9

                              mrjjM 1 Reply Last reply
                              0
                              • M Mikeeeeee

                                I use Android 5,6,9

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #25

                                @mikeeeeee
                                Well if possible you can try on another android device to see if same happens.

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  Mikeeeeee
                                  wrote on last edited by
                                  #26

                                  I use 3 android device

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    Mikeeeeee
                                    wrote on last edited by
                                    #27

                                    Does this code work on your phone? And if it works, what version of the code?

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      Mikeeeeee
                                      wrote on last edited by
                                      #28

                                      Maybe you know how use for this Android API?

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        Mikeeeeee
                                        wrote on last edited by
                                        #29

                                        it's work https://doc.qt.io/qt-5/qml-qtquick-item.html#grabToImage-method

                                        1 Reply Last reply
                                        1

                                        • Login

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