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. QByteArray to Gif

QByteArray to Gif

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 5 Posters 1.3k 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.
  • M Offline
    M Offline
    Melia
    wrote on last edited by
    #1

    Hi, I want to run a QMovide gif but using qbytearray.

    jsulmJ 1 Reply Last reply
    0
    • M Melia

      Hi, I want to run a QMovide gif but using qbytearray.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Melia Create an https://doc.qt.io/qt-5/qbuffer.html instance with your QByteArray and use it with https://doc.qt.io/qt-5/qmovie.html#QMovie-1

      https://forum.qt.io/topic/113070/qt-code-of-conduct

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

        QByteArray ba = mygif
        QBuffer * data = new QBuffer(&ba);
        QMovie *gif = new QMovie(data);
        ui->mylabel->setMovie(gif);
        gif->start();
        I tried this but the program crashes

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Melia said in QByteArray to Gif:

          I tried this but the program crashes

          Because QByteArray ba goes out of scope. Use QBuffer::setData() for example.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          5
          • M Offline
            M Offline
            Melia
            wrote on last edited by
            #5

            Worked! How can I do with QMovie border radius

            jsulmJ 1 Reply Last reply
            0
            • M Melia

              Worked! How can I do with QMovie border radius

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Melia said in QByteArray to Gif:

              How can I do with QMovie border radius

              What do you mean? What border radius?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Melia
                wrote on last edited by
                #7

                I want to make a gif avatar.

                jsulmJ JonBJ 2 Replies Last reply
                0
                • M Melia

                  I want to make a gif avatar.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Melia Sorry, I don't know what exactly you mean. Please explain clearly.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • M Melia

                    I want to make a gif avatar.

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #9

                    @Melia
                    QMovie's don't have a border or radius per se. If it's an animated GIF you would need to take the GIF frames' size to get measurements, if that's what you have in mind?

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

                      examples
                      It will be both gif and round

                      jsulmJ 1 Reply Last reply
                      0
                      • M Melia

                        examples
                        It will be both gif and round

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Melia Can't you create a Gif with transparency? I mean, the part outside of that round central part can be simply transparent.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                          alt text
                          Gifs will be random. I thought something like but how can I do it?

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Hi,

                            One way to do it would be to subclass QLabel and reimplement the paintEvent method, there you start by letting the original do its work and then apply an overlay on it.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Melia
                              wrote on last edited by
                              #14

                              How can I do it? I do not know

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                As I wrote, subclass QLabel, re-implement paintEvent, call the base classe implementation and then do your own painting.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                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