Qt, 3rd Party Library and Fast Drawing



  • Hi All,

    I'm in the process of moving one of our in-house software packages over to Qt from Delphi. The application in question uses a 3rd party library which exposes a number of API functions - one of which draws onto a HDC.

    Using my limited knowledge of Qt, I've successfully managed to bring in this 3rd party library and I'm able to successfully call these API routines. So far so good. However, I'm yet to find the most efficient way of calling the API function to draw onto a HDC within Qt while maintaining good performance.

    My solution so far see's me handle a QWidget "paintEvent", inside which I call CreateCompatibleBitmap/DC and then draw onto that first. I then take the HBITMAP and turn it into a QImage (via a QPixmap -> QtWin::fromHBITMAP) before painting it through my QPainter.

    This seems a bit clunky and a bit messy and going via the QPixmap/QImage is a little sluggish when compared to the equivalent Delphi application. So ultimately, what I'd like to know is, is there a better way to tackle this?

    Thanks in advance for any advice.


  • Lifetime Qt Champion

    Hi,

    This stackoverflow answer might give some nice clues.

    Hope it helps



  • @SGaist Thanks for the link. I shall give this a try.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.