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. Drawing Images in Widget PaintEvent using existing buffer
QtWS25 Last Chance

Drawing Images in Widget PaintEvent using existing buffer

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgetqimageqpixmappaint event
2 Posts 2 Posters 1.9k 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
    SilverSurfer
    wrote on last edited by
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0

      • Login

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