mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:16:58 +02:00
Merge pull request #760 from Atlante45/fix_key_press_event
Fix key press event
This commit is contained in:
commit
447e332b6f
2 changed files with 92 additions and 14 deletions
|
@ -570,7 +570,9 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
if (_simulateLeapHand->isChecked() || _testRaveGlove->isChecked()) {
|
if (_simulateLeapHand->isChecked() || _testRaveGlove->isChecked()) {
|
||||||
_myAvatar.getHand().setRaveGloveEffectsMode((QKeyEvent*)event);
|
_myAvatar.getHand().setRaveGloveEffectsMode((QKeyEvent*)event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool alt = event->modifiers().testFlag(Qt::AltModifier);
|
||||||
|
bool meta = event->modifiers().testFlag(Qt::MetaModifier);
|
||||||
bool shifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
bool shifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
case Qt::Key_BracketLeft:
|
case Qt::Key_BracketLeft:
|
||||||
|
@ -644,7 +646,13 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_C:
|
case Qt::Key_C:
|
||||||
_myAvatar.setDriveKeys(DOWN, 1);
|
if (shifted) {
|
||||||
|
_occlusionCulling->trigger();
|
||||||
|
} else if (meta) {
|
||||||
|
chooseVoxelPaintColor();
|
||||||
|
} else {
|
||||||
|
_myAvatar.setDriveKeys(DOWN, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_W:
|
case Qt::Key_W:
|
||||||
|
@ -652,7 +660,11 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_S:
|
case Qt::Key_S:
|
||||||
_myAvatar.setDriveKeys(BACK, 1);
|
if (shifted) {
|
||||||
|
doTreeStats();
|
||||||
|
} else {
|
||||||
|
_myAvatar.setDriveKeys(BACK, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_Space:
|
case Qt::Key_Space:
|
||||||
|
@ -661,11 +673,19 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_G:
|
case Qt::Key_G:
|
||||||
goHome();
|
if (shifted) {
|
||||||
|
_gravityUse->trigger();
|
||||||
|
} else {
|
||||||
|
_eyedropperMode->trigger();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_A:
|
case Qt::Key_A:
|
||||||
_myAvatar.setDriveKeys(ROT_LEFT, 1);
|
if (shifted) {
|
||||||
|
_renderAtmosphereOn->trigger();
|
||||||
|
} else {
|
||||||
|
_myAvatar.setDriveKeys(ROT_LEFT, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_D:
|
case Qt::Key_D:
|
||||||
|
@ -755,12 +775,66 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
}
|
}
|
||||||
resizeGL(_glWidget->width(), _glWidget->height());
|
resizeGL(_glWidget->width(), _glWidget->height());
|
||||||
break;
|
break;
|
||||||
|
case Qt::Key_N:
|
||||||
|
_noise->trigger();
|
||||||
|
break;
|
||||||
|
case Qt::Key_H:
|
||||||
|
_lookingInMirror->trigger();
|
||||||
|
break;
|
||||||
|
case Qt::Key_F:
|
||||||
|
if (shifted) {
|
||||||
|
_frustumOn->trigger();
|
||||||
|
} else {
|
||||||
|
_fullScreenMode->trigger();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_V:
|
||||||
|
if (shifted) {
|
||||||
|
_renderVoxels->trigger();
|
||||||
|
} else {
|
||||||
|
_addVoxelMode->trigger();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_P:
|
||||||
|
_manualFirstPerson->trigger();
|
||||||
|
break;
|
||||||
|
case Qt::Key_R:
|
||||||
|
if (shifted) {
|
||||||
|
_frustumRenderModeAction->trigger();
|
||||||
|
} else {
|
||||||
|
_deleteVoxelMode->trigger();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_B:
|
||||||
|
_colorVoxelMode->trigger();
|
||||||
|
break;
|
||||||
|
case Qt::Key_O:
|
||||||
|
if (shifted) {
|
||||||
|
_viewFrustumFromOffset->trigger();
|
||||||
|
} else {
|
||||||
|
_selectVoxelMode->trigger();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_Slash:
|
||||||
|
_renderStatsOn->trigger();
|
||||||
|
break;
|
||||||
case Qt::Key_Backspace:
|
case Qt::Key_Backspace:
|
||||||
case Qt::Key_Delete:
|
case Qt::Key_Delete:
|
||||||
if (_selectVoxelMode->isChecked()) {
|
if (_selectVoxelMode->isChecked()) {
|
||||||
deleteVoxelUnderCursor();
|
deleteVoxelUnderCursor();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Qt::Key_Plus:
|
||||||
|
if (alt) {
|
||||||
|
increaseAvatarSize();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Qt::Key_Minus:
|
||||||
|
if (alt) {
|
||||||
|
decreaseAvatarSize();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Qt::Key_1:
|
case Qt::Key_1:
|
||||||
case Qt::Key_2:
|
case Qt::Key_2:
|
||||||
case Qt::Key_3:
|
case Qt::Key_3:
|
||||||
|
@ -1791,10 +1865,12 @@ void Application::initMenu() {
|
||||||
_window->setMenuBar(menuBar);
|
_window->setMenuBar(menuBar);
|
||||||
|
|
||||||
QMenu* fileMenu = menuBar->addMenu("File");
|
QMenu* fileMenu = menuBar->addMenu("File");
|
||||||
fileMenu->addAction("Quit", this, SLOT(quit()), Qt::CTRL | Qt::Key_Q);
|
QAction* quitAction = fileMenu->addAction("Quit", this, SLOT(quit()), Qt::CTRL | Qt::Key_Q);
|
||||||
|
quitAction->setMenuRole(QAction::QuitRole);
|
||||||
|
|
||||||
QMenu* editMenu = menuBar->addMenu("Edit");
|
QMenu* editMenu = menuBar->addMenu("Edit");
|
||||||
editMenu->addAction("Preferences...", this, SLOT(editPreferences()));
|
QAction* preferencesAction = editMenu->addAction("Preferences...", this, SLOT(editPreferences()), Qt::CTRL | Qt::Key_Comma);
|
||||||
|
preferencesAction->setMenuRole(QAction::PreferencesRole);
|
||||||
|
|
||||||
QMenu* pairMenu = menuBar->addMenu("Pair");
|
QMenu* pairMenu = menuBar->addMenu("Pair");
|
||||||
pairMenu->addAction("Pair", this, SLOT(pair()));
|
pairMenu->addAction("Pair", this, SLOT(pair()));
|
||||||
|
@ -1803,7 +1879,7 @@ void Application::initMenu() {
|
||||||
(_lookingInMirror = optionsMenu->addAction("Mirror", this, SLOT(setRenderMirrored(bool)), Qt::Key_H))->setCheckable(true);
|
(_lookingInMirror = optionsMenu->addAction("Mirror", this, SLOT(setRenderMirrored(bool)), Qt::Key_H))->setCheckable(true);
|
||||||
(_echoAudioMode = optionsMenu->addAction("Echo Audio"))->setCheckable(true);
|
(_echoAudioMode = optionsMenu->addAction("Echo Audio"))->setCheckable(true);
|
||||||
|
|
||||||
optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N)->setCheckable(true);
|
(_noise = optionsMenu->addAction("Noise", this, SLOT(setNoise(bool)), Qt::Key_N))->setCheckable(true);
|
||||||
(_gyroLook = optionsMenu->addAction("Smooth Gyro Look"))->setCheckable(true);
|
(_gyroLook = optionsMenu->addAction("Smooth Gyro Look"))->setCheckable(true);
|
||||||
_gyroLook->setChecked(true);
|
_gyroLook->setChecked(true);
|
||||||
(_showHeadMouse = optionsMenu->addAction("Head Mouse"))->setCheckable(true);
|
(_showHeadMouse = optionsMenu->addAction("Head Mouse"))->setCheckable(true);
|
||||||
|
@ -1819,7 +1895,7 @@ void Application::initMenu() {
|
||||||
optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
|
optionsMenu->addAction("Webcam", &_webcam, SLOT(setEnabled(bool)))->setCheckable(true);
|
||||||
optionsMenu->addAction("Toggle Skeleton Tracking", &_webcam, SLOT(setSkeletonTrackingOn(bool)))->setCheckable(true);
|
optionsMenu->addAction("Toggle Skeleton Tracking", &_webcam, SLOT(setSkeletonTrackingOn(bool)))->setCheckable(true);
|
||||||
optionsMenu->addAction("Cycle Webcam Send Mode", _webcam.getGrabber(), SLOT(cycleVideoSendMode()));
|
optionsMenu->addAction("Cycle Webcam Send Mode", _webcam.getGrabber(), SLOT(cycleVideoSendMode()));
|
||||||
optionsMenu->addAction("Go Home", this, SLOT(goHome()));
|
optionsMenu->addAction("Go Home", this, SLOT(goHome()), Qt::CTRL | Qt::Key_G);
|
||||||
|
|
||||||
QMenu* renderMenu = menuBar->addMenu("Render");
|
QMenu* renderMenu = menuBar->addMenu("Render");
|
||||||
(_renderVoxels = renderMenu->addAction("Voxels", this, SLOT(setRenderVoxels(bool)), Qt::SHIFT | Qt::Key_V))->setCheckable(true);
|
(_renderVoxels = renderMenu->addAction("Voxels", this, SLOT(setRenderVoxels(bool)), Qt::SHIFT | Qt::Key_V))->setCheckable(true);
|
||||||
|
@ -1888,8 +1964,8 @@ void Application::initMenu() {
|
||||||
"Get Color Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_G))->setCheckable(true);
|
"Get Color Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_G))->setCheckable(true);
|
||||||
_voxelModeActions->addAction(_eyedropperMode);
|
_voxelModeActions->addAction(_eyedropperMode);
|
||||||
|
|
||||||
voxelMenu->addAction("Decrease Voxel Size", this, SLOT(decreaseVoxelSize()), QKeySequence::ZoomOut);
|
voxelMenu->addAction("Decrease Voxel Size", this, SLOT(decreaseVoxelSize()), QKeySequence::ZoomOut);
|
||||||
voxelMenu->addAction("Increase Voxel Size", this, SLOT(increaseVoxelSize()), QKeySequence::ZoomIn);
|
voxelMenu->addAction("Increase Voxel Size", this, SLOT(increaseVoxelSize()), QKeySequence::ZoomIn);
|
||||||
voxelMenu->addAction("Reset Swatch Colors", this, SLOT(resetSwatchColors()));
|
voxelMenu->addAction("Reset Swatch Colors", this, SLOT(resetSwatchColors()));
|
||||||
|
|
||||||
_voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this,
|
_voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this,
|
||||||
|
@ -1916,7 +1992,7 @@ void Application::initMenu() {
|
||||||
(_viewFrustumFromOffset = frustumMenu->addAction(
|
(_viewFrustumFromOffset = frustumMenu->addAction(
|
||||||
"Use Offset Camera", this, SLOT(setFrustumOffset(bool)), Qt::SHIFT | Qt::Key_O))->setCheckable(true);
|
"Use Offset Camera", this, SLOT(setFrustumOffset(bool)), Qt::SHIFT | Qt::Key_O))->setCheckable(true);
|
||||||
_frustumRenderModeAction = frustumMenu->addAction(
|
_frustumRenderModeAction = frustumMenu->addAction(
|
||||||
"Render Mode", this, SLOT(cycleFrustumRenderMode()), Qt::SHIFT | Qt::Key_R);
|
"Render Mode", this, SLOT(cycleFrustumRenderMode()), Qt::SHIFT | Qt::Key_R);
|
||||||
updateFrustumRenderModeAction();
|
updateFrustumRenderModeAction();
|
||||||
|
|
||||||
debugMenu->addAction("Run Timing Tests", this, SLOT(runTests()));
|
debugMenu->addAction("Run Timing Tests", this, SLOT(runTests()));
|
||||||
|
@ -1940,8 +2016,8 @@ void Application::initMenu() {
|
||||||
debugMenu->addAction("Wants Monochrome", this, SLOT(setWantsMonochrome(bool)))->setCheckable(true);
|
debugMenu->addAction("Wants Monochrome", this, SLOT(setWantsMonochrome(bool)))->setCheckable(true);
|
||||||
debugMenu->addAction("Use Lower Resolution While Moving", this, SLOT(setWantsLowResMoving(bool)))->setCheckable(true);
|
debugMenu->addAction("Use Lower Resolution While Moving", this, SLOT(setWantsLowResMoving(bool)))->setCheckable(true);
|
||||||
debugMenu->addAction("Disable Delta Sending", this, SLOT(disableDeltaSending(bool)))->setCheckable(true);
|
debugMenu->addAction("Disable Delta Sending", this, SLOT(disableDeltaSending(bool)))->setCheckable(true);
|
||||||
debugMenu->addAction("Disable Occlusion Culling", this, SLOT(disableOcclusionCulling(bool)),
|
(_occlusionCulling = debugMenu->addAction("Disable Occlusion Culling", this, SLOT(disableOcclusionCulling(bool)),
|
||||||
Qt::SHIFT | Qt::Key_C)->setCheckable(true);
|
Qt::SHIFT | Qt::Key_C))->setCheckable(true);
|
||||||
|
|
||||||
(_renderCoverageMap = debugMenu->addAction("Render Coverage Map"))->setCheckable(true);
|
(_renderCoverageMap = debugMenu->addAction("Render Coverage Map"))->setCheckable(true);
|
||||||
_renderCoverageMap->setShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_O);
|
_renderCoverageMap->setShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_O);
|
||||||
|
|
|
@ -288,6 +288,8 @@ private:
|
||||||
QAction* _fullScreenMode; // whether we are in full screen mode
|
QAction* _fullScreenMode; // whether we are in full screen mode
|
||||||
QAction* _frustumRenderModeAction;
|
QAction* _frustumRenderModeAction;
|
||||||
QAction* _settingsAutosave; // Whether settings are saved automatically
|
QAction* _settingsAutosave; // Whether settings are saved automatically
|
||||||
|
QAction* _noise;
|
||||||
|
QAction* _occlusionCulling;
|
||||||
|
|
||||||
QAction* _renderCoverageMapV2;
|
QAction* _renderCoverageMapV2;
|
||||||
QAction* _renderCoverageMap;
|
QAction* _renderCoverageMap;
|
||||||
|
|
Loading…
Reference in a new issue