Win bitmap to QPixmap not working



  • When I try to convert a windows bitmap to a qt bitmap I get this error:

    unresolved external symbol "_declspec(dllimport) class QPixmap cdecl QtWin::fromHBITMAP(struct HBITMAP *,enum QtWin::HBitmapFormat)" (imp?fromHBITMAP@QtWin@@YA?AVQPixmap@@PEAUHBITMAP@@W4HBitmapFormat@1@@Z) referenced in function "private: void __cdecl Dialog::clicked(void)" (?clicked@Dialog@@AEAAXXZ)

    This is the code:

    		QPixmap winPix = QtWin::fromHBITMAP(hBitmap, QtWin::HBitmapPremultipliedAlpha);
    		winPix.save(&winBuffer, "PNG");
    

    I must be missing something, don't know what though.

    Any help would be appreciated :)


  • Moderators

    @Alexlander
    did you link against QtWinExtras module?



  • I just included with #include <QtWinExtras\QtWinExtras>


  • Moderators

    @Alexlander
    I was asking about linking.
    Make sure your pro file contains QT += winextras and rerun qmake before building again



  • @raven-worx Of course, I was using Qt Tools for windows studio, just had to right click and add a module, thanks!


Log in to reply
 

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