PDA

View Full Version : QPixmap::toWinHBITMAP missing on windows



kemege
1st January 2013, 03:17
I'm trying to write a shell extension with Qt 5.0.0, following this tutorial:
http://www.qtcentre.org/threads/32104-howto-making-a-windows-shell-extension-with-qt-open-source-edition

and since I'd like to create file thumbnails with this extension, I need to write this IThumbnailProvider::GetThumbnail method, whose definition is :HRESULT GetThumbnail( [in] UINT cx, [out] HBITMAP *phbmp, [out] WTS_ALPHATYPE *pdwAlpha );
So I have to convert my image into a HBITMAP.

I googled and find a method QPixmap::toWinHBITMAP().
My code is:


QImage base;
base.load("./torrent.png");
QPixmap basepix;
basepix.convertFromImage(base);
HBITMAP phbmp = basepix.toWinHBITMAP(QPixmap::PremultipliedAlpha);

but when I tried to use it, I found that this wasn't defined. QPixmap::fromWinHBITMAP() is not defined as well, although I did find it in the Qt Help on my computer.

Please help :confused:

boudie
1st January 2013, 11:27
Did you notice it's only available on Windows?

ChrisW67
1st January 2013, 22:03
I'm sure kemege did notice that given the title of the post. The function is not declared in the Qt5 QPixmap header, and only appears in the doc comments of the cpp file AFAICT (I grepped the source). This would be consistent with kemege's observation that the function is MIA.

The function was removed a long time ago by commit bc0a028 (http://qt.gitorious.org/qt/qtbase/commit/bc0a0281d535079745ed1544a063571b86ca718e)


Get rid of some obsolete functions in QImage / QPixmap / QPixmapData.

It's not clear the reasoning or proposed alternative.

kemege
2nd January 2013, 08:03
I'm sure kemege did notice that given the title of the post. The function is not declared in the Qt5 QPixmap header, and only appears in the doc comments of the cpp file AFAICT (I grepped the source). This would be consistent with kemege's observation that the function is MIA.

The function was removed a long time ago by commit bc0a028 (http://qt.gitorious.org/qt/qtbase/commit/bc0a0281d535079745ed1544a063571b86ca718e)

It's not clear the reasoning or proposed alternative.
Thank you for your reply, ChrisW67:)
Maybe I'll have to find some other ways to get a HBITMAP...... such as save it to a file and use LoadImage() to get a HBITMAP.