. 이 메서드는 OgreWidget::initialize
메서드의 일부로 OgreWidget
하위 클래스 QWidget
입니다. initialize
이 OgreWidget
의 구성 부분으로 호출되고 m_OgreRoot
이 할당되고 렌더 시스템이 설정된 후에
setAttribute(Qt::WA_PaintOnScreen, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setFocusPolicy(Qt::StrongFocus);
Ogre::String winHandle;
QX11Info info = x11Info();
winHandle = Ogre::StringConverter::toString((unsigned long)(info.display()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned int)(info.screen()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned long)(winId()));
Ogre::NameValuePairList params;
params["parentWindowHandle"] = winHandle;
params["FSAA"] = Ogre::String("8");
int w = width();
int h = height();
// Need to call XSync or the window handles will be invalid.
XSync(info.display(), False);
m_OgreWindow =
m_OgreRoot->createRenderWindow("OgreWidget_RenderWindow",
qMax(w, 640), qMax(h, 480), false, ¶ms);
Qt 5.1.0과 동일한 코드가 수정되었습니다. QX11Info
이 Qt 5.0.x에서 제거 된 후 Qt 5.1.0의 "extras"구성 요소에 추가되었습니다. 새 QX11Info
클래스에는 정적 메서드 만 있습니다.
#include <QtX11Extras/QX11Info>
...
setAttribute(Qt::WA_PaintOnScreen, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setFocusPolicy(Qt::StrongFocus);
Ogre::String winHandle;
winHandle = Ogre::StringConverter::toString((unsigned long)(QX11Info::display()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned int)(QX11Info::appScreen()));
winHandle += ":";
winHandle += Ogre::StringConverter::toString((unsigned long)(winId()));
Ogre::NameValuePairList params;
params["parentWindowHandle"] = winHandle;
params["FSAA"] = Ogre::String("8");
int w = width();
int h = height();
// Need to call XSync or the window handles will be invalid.
XSync(QX11Info::display(), False);
m_OgreWindow =
m_OgreRoot->createRenderWindow("OgreWidget_RenderWindow",
qMax(w, 640), qMax(h, 480), false, ¶ms);