fix crash in activateWindowAfterEnterMode in no oculus case

This commit is contained in:
ZappoMan 2014-11-26 10:53:38 -08:00
parent ad6680553c
commit 0c5a978411

View file

@ -126,9 +126,9 @@ void HMDToolsDialog::enterModeClicked(bool checked) {
void HMDToolsDialog::activateWindowAfterEnterMode() { void HMDToolsDialog::activateWindowAfterEnterMode() {
Application::getInstance()->getWindow()->activateWindow(); Application::getInstance()->getWindow()->activateWindow();
QWindow* mainWindow = Application::getInstance()->getWindow()->windowHandle();
QPoint windowCenter = mainWindow->geometry().center(); // center the cursor on the main application window
QCursor::setPos(_hmdScreen, windowCenter); centerCursorOnWidget(Application::getInstance()->getWindow());
} }
@ -178,10 +178,12 @@ void HMDToolsDialog::centerCursorOnWidget(QWidget* widget) {
} }
void HMDToolsDialog::showEvent(QShowEvent* event) { void HMDToolsDialog::showEvent(QShowEvent* event) {
// center the cursor on the hmd tools dialog
centerCursorOnWidget(this); centerCursorOnWidget(this);
} }
void HMDToolsDialog::hideEvent(QHideEvent* event) { void HMDToolsDialog::hideEvent(QHideEvent* event) {
// center the cursor on the main application window
centerCursorOnWidget(Application::getInstance()->getWindow()); centerCursorOnWidget(Application::getInstance()->getWindow());
} }