대신 win32 api 그래프 라이브러리를 변환하여 qt 라이브러리를 사용합니다. 필자는 XP에서 성공적으로 컴파일 할 수 있었으며 이제 새롭고 향상된 그래프 라이브러리의 진정한 크로스 플랫폼 기능을 테스트하기 위해 우분투 (9.10)에서 빌드하려고 시도하고 있습니다.QBitmap의 QPixmap
몇 가지 컴파일 타임 오류가 발생했습니다. 클래스 중 일부는 Windows에만 한정되어 있으므로 코드를 다시 수정해야합니다.
//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);