PDA

View Full Version : Problems with QPixmap::fromWinHICON( (HICON) GetCursor() ); (Windows)



GreyHound
3rd April 2010, 18:10
Hi, i'm trying to built a custom cursor by assembling the current cursor and another QImage. Unfortunately i get weird behavior when i try to use



QPixmap cursor = QPixmap::fromWinHICON( (HICON) GetCursor() );


If i instantly save the QPixmap "cursor" to disk i get the following result.
http://www.weown.de/files/misc/cursor.jpg
If you use the default windows cursor you can easily compare your cursor with the image, something is wrong there.
The image should be 32x32 but is only 20x20. I guess this might be connected with the fact that the cursor has it's hotspot at (10,10) so the hotspot is expected to be the icon center so some kind of downsampling occurs.


Note that i'm using the standard cursor in it's default size. I don't really know why QPixmap::fromWinHICON( (HICON) GetCursor() ); generates this small Version.

I currently have a workarround where i save the HICON to disc using winapi methods and then load the ico using


QPixmap cursorMap = QPixmap("default.ico");

Does anyone have an idea why the fromWinHICON way does not work properly? Did i miss something?

Thanks a lot

I experience that using QT 4.6.2