I am converting a win32 api graphing library to use the qt library instead. I have managed to compile succesfully on XP, now to test true cross-platform capability of the new and improved graphing library, I am attempting to build it on Ubuntu (9.10).
I have encountered a couple of compile time erros - because some of the classes are Windows specific, so I need to modify the code again.
I have a section of code which looks like this:
//original code (compiled succesfully under Windows)
unsigned short fill[4];
fill[0] = (unsigned short)(pattern & 0xF000) >> 8;
fill[1] = (unsigned short)(pattern & 0x0F00) >> 4;
fill[2] = (unsigned short)(pattern & 0x00F0);
fill[3] = (unsigned short)(pattern & 0x000F) >> 4;
HBITMAP hbmp = CreateBitmap(4, 4, 1, 1, fill);
QPixmap texture;
texture.fromWinHBITMAP(hbmp);
DeleteObject(hbmp);
brush1.setTexture(texture);
//Code to compile on Ubuntu
unsigned short fill[4];
fill[0] = (unsigned short)(pattern & 0xF000) >> 8;
fill[1] = (unsigned short)(pattern & 0x0F00) >> 4;
fill[2] = (unsigned short)(pattern & 0x00F0);
fill[3] = (unsigned short)(pattern & 0x000F) >> 4;
QBitmap bmp(4, 4, fill); //Is this correct ?
QPixmap texture;
texture.fromWinHBITMAP(bmp); // How to convert QBitmap to QPixmap ?
//DeleteObject(hbmp); // No longer required (local object scope)
brush1.setTexture(texture);