Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Drawing Images in Widget PaintEvent using existing buffer

    General and Desktop
    qwidget qimage qpixmap paint event
    2
    2
    1568
    Loading More Posts
    • 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
      SilverSurfer last edited by

      Hi,
      I need to draw Image on a widget without performing any copy operation.
      Please refer code below

      //supposed to be called 30 times a second.
      BaseWidget::getImageData(uchar* buf, size_t size)
      {
         //copy happening here.
          m_pQPixmap->loadFromData(buf,size,"BMP");
          this->update();
      
      } 
      BaseWidget::paintEvent()
      {
      ...
              painter.drawPixmap(rect,*m_pQPixmap,
                            m_pQImage->rect());
        
      ...
      }
      
      

      Related To: https://forum.qt.io/topic/87175/qwidget-flickering-for-frame-by-frame-streaming-of-video/11

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        See my answer one the other thread.

        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 Reply Quote 0
        • First post
          Last post