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. Adding QPixmap to QLabel , flickering is happening.
Forum Updated to NodeBB v4.3 + New Features

Adding QPixmap to QLabel , flickering is happening.

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 1.8k Views 3 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    Hi,

    I have the buffer, adding it to QPixmap to QLabel for showing images, continously.

    m_pixMap.loadFromData(QByteArray((char*)buf,size));
    m_pixMap1 = m_pixMap.scaled(label->width(),label->height(),Qt::IgnoreAspectRatio);
    label->setPixmap(m_pixMap1);

    How can i avoid filckering in QLabel,

    Thanks,

    Pradeep Kumar
    Qt,QML Developer

    J.HilkJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What size of image ?
      How fast ?
      Where do they come from ?

      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
      • Pradeep KumarP Pradeep Kumar

        Hi,

        I have the buffer, adding it to QPixmap to QLabel for showing images, continously.

        m_pixMap.loadFromData(QByteArray((char*)buf,size));
        m_pixMap1 = m_pixMap.scaled(label->width(),label->height(),Qt::IgnoreAspectRatio);
        label->setPixmap(m_pixMap1);

        How can i avoid filckering in QLabel,

        Thanks,

        J.HilkJ Online
        J.HilkJ Online
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Pradeep-Kumar said in Adding QPixmap to QLabel , flickering is happening.:

        Hi,

        I have the buffer, adding it to QPixmap to QLabel for showing images, continously.

        m_pixMap.loadFromData(QByteArray((char*)buf,size));
        m_pixMap1 = m_pixMap.scaled(label->width(),label->height(),Qt::IgnoreAspectRatio);
        label->setPixmap(m_pixMap1);

        How can i avoid filckering in QLabel,

        Thanks,

        If you ignore the aspect ratio than this approach might be more usefull and without error:

        label->setScaledContents(true);
        label->setPixmap(m_pixMap.loadFromData(QByteArray((char*)buf,size)));
        

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #4

          @J-Hilk

          I tried adding the

          label->setScaledContents(true);
          m_pixMap.loadFromData(QByteArray((char*)buf,size));
          label->setPixmap(m_pixMap);,

          still flickering is happening.

          Thanks,

          Pradeep Kumar
          Qt,QML Developer

          J.HilkJ 1 Reply Last reply
          0
          • Pradeep KumarP Pradeep Kumar

            @J-Hilk

            I tried adding the

            label->setScaledContents(true);
            m_pixMap.loadFromData(QByteArray((char*)buf,size));
            label->setPixmap(m_pixMap);,

            still flickering is happening.

            Thanks,

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @Pradeep-Kumar ok, we need some more information:
            You say, that you change the image continiously, how fast? Maybe iots to fast and the other Images are not painted properly resulting in flickering?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #6

              Images are coming from server, 15fps,

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

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

                Again: what size are they ?
                Also, what format ?

                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
                • Pradeep KumarP Offline
                  Pradeep KumarP Offline
                  Pradeep Kumar
                  wrote on last edited by
                  #8

                  Bitmap format.,
                  and the size of image depends on the width, height of Widget.

                  Thanks,

                  Pradeep Kumar
                  Qt,QML Developer

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

                    Are you saying the image data your receive is already the size of your QLabel ?

                    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

                    • Login

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