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
Forum Updated to NodeBB v4.3 + New Features

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 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.
  • S Offline
    S Offline
    SilverSurfer
    wrote on 1 Feb 2018, 12:25 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Feb 2018, 21:28 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

      1/2

      1 Feb 2018, 12:25

      • Login

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