Hi there,
first I have to say sorry for my english.

I' ve got this problem:
I want to change the "drawPixmap(..)" methode. I've red in the Qt-Assistant there is the class QPaintEngine, wich is pure virtual. So I must reimplement this class. I've done it. Here is the code:
the header.
Qt Code:
  1. class MyPaintEngine : public QPaintEngine
  2. {
  3. //Q_OBJECT
  4.  
  5. private:
  6. HDC mHDC;
  7.  
  8. public:
  9. MyPaintEngine(PaintEngineFeatures caps = 0);
  10. ~MyPaintEngine();
  11.  
  12. bool begin(QPaintDevice* pdev);
  13. void setHDC(const HDC& hDC);
  14. void drawPixmap(const QRectF& r,const QPixmap& pm, const QRectF& sr );
  15. bool end();
  16. QPaintEngine::Type type() const;
  17. void updateState(const QPaintEngineState& state );
  18. void drawPolygon ( const QPoint * points, int pointCount, PolygonDrawMode mode );
  19. };
To copy to clipboard, switch view to plain text mode 

the cpp.
Qt Code:
  1. void MyPaintEngine::drawPixmap(const QRectF& r,const QPixmap& pm, const QRectF& sr )
  2. {
  3. const unsigned int width(300),height(300);
  4. unsigned char* pixelBuffer = new unsigned char[height*width*4];
  5. unsigned int ii(0);
  6. for(int xx(0); xx<width; ++xx)
  7. {
  8. for(int yy(0); yy<height; ++yy)
  9. {
  10. pixelBuffer[ii] = 255;
  11. ++ii;
  12. pixelBuffer[ii] = 0;
  13. ++ii;
  14. pixelBuffer[ii] = 0;
  15. ++ii;
  16. pixelBuffer[ii] = 0;
  17. ++ii;
  18. }
  19. }
  20. BITMAP bmp;
  21. HDC hDCBmp(CreateCompatibleDC(mHDC)); // mHDC is a member which I set before i call this methode
  22. DWORD error(GetLastError());
  23. HBITMAP hBitmap(CreateCompatibleBitmap(mHDC,width,height));
  24. SelectObject (hDCBmp, hBitmap) ;
  25. SetBitmapBits(hBitmap,width*height*4,pixelBuffer);
  26.  
  27.  
  28. BitBlt(mHDC,(int)(100),(int)(100), 300,300, hDCBmp, 0,0, SRCCOPY);
  29. }
To copy to clipboard, switch view to plain text mode 

But this doesn't work. I only get my window in the default color.
I choose this as an example, only drawing a blue rect.

Why it doesn't work?
What I have to do?
Can anybody help my please?