Hello!

I'm trying to create a widget which encapsulate the Direct3D engine(something like OpenGL widget). I have the following code:
.h
Qt Code:
  1. class Direct3DWidget : public QWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. Direct3DWidget(QWidget *parent = 0);
  6. ~Direct3DWidget();
  7. bool InitDirect3D();
  8. public slots:
  9. bool Rendering();
  10. private:
  11. void paintEvent(QPaintEvent *p)
  12. {
  13. Rendering();
  14. }
  15. QPaintEngine* paintEngine()
  16. {
  17. return NULL;
  18. }
  19. LPDIRECT3D9 m_pD3D;
  20. LPDIRECT3DDEVICE9 m_pd3dDevice;
  21. };
To copy to clipboard, switch view to plain text mode 
.cpp
Qt Code:
  1. Direct3DWidget::Direct3DWidget(QWidget *parent /* = 0 */)
  2. {
  3. setFixedSize(200, 200);
  4. setAutoFillBackground(false);
  5. setAttribute(Qt::WA_PaintOnScreen, true);
  6. }
  7. Direct3DWidget::~Direct3DWidget()
  8. {
  9. if( m_pd3dDevice != NULL)
  10. m_pd3dDevice->Release();
  11.  
  12. if( m_pD3D != NULL)
  13. m_pD3D->Release();
  14. }
  15. bool Direct3DWidget::InitDirect3D()
  16. {
  17. m_pD3D = Direct3DCreate9( D3D_SDK_VERSION);
  18. if( !m_pD3D)
  19. return false;
  20.  
  21. D3DPRESENT_PARAMETERS d3dpp = {0};
  22. d3dpp.Windowed = TRUE;
  23. d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  24. d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
  25. d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
  26. d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
  27. d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
  28. d3dpp.EnableAutoDepthStencil = TRUE;
  29. d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
  30. HRESULT hr = m_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, winId(),
  31. D3DCREATE_HARDWARE_VERTEXPROCESSING,
  32. &d3dpp, &m_pd3dDevice );
  33. if( FAILED(hr) || !m_pd3dDevice)
  34. return false;
  35. }
  36. bool Direct3DWidget::Rendering()
  37. {
  38. if(m_pd3dDevice == NULL)
  39. return false;
  40. m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 255, 0), 1.0f, 0);
  41. if(SUCCEEDED(m_pd3dDevice->BeginScene()))
  42. {
  43. m_pd3dDevice->EndScene();
  44. }
  45. m_pd3dDevice->Present( NULL, NULL, NULL, NULL );
  46. return true;
  47. }
To copy to clipboard, switch view to plain text mode 
main.cpp
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4.  
  5. QMainWindow window;
  6. Direct3DWidget* widget = new Direct3DWidget(&window);
  7.  
  8. window.show();
  9. widget->InitDirect3D();
  10. return a.exec();
  11. }
To copy to clipboard, switch view to plain text mode 

But this code does nothing . What should I change to gain the appropriate behavior?
I'll be glad for any advices regarding the Direct3D.