Skip to content

Instantly share code, notes, and snippets.

@oguna
Created August 7, 2014 13:52
Show Gist options
  • Select an option

  • Save oguna/d83a5a6df5eeb9b178d8 to your computer and use it in GitHub Desktop.

Select an option

Save oguna/d83a5a6df5eeb9b178d8 to your computer and use it in GitHub Desktop.
QtでDirectXなどの描画をする際は、winId()のハンドラを使う。
QD3D11Widget::QD3D11Widget(QWidget *parent) :
QWidget(parent)
{
// バッファリングをしないようにする
setAttribute(Qt::WA_PaintOnScreen, true);
// ハンドラの再利用を禁止する
setAttribute(Qt::WA_NativeWindow, true);
m_hWnd = (HWND)winId();
HRESULT hr = InitDevice();
}
void D3DRenderWidget::paintEvent(QPaintEvent* evt) {
render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment