diff --git a/Source/RMG-Input/UserInterface/EventFilter.cpp b/Source/RMG-Input/UserInterface/EventFilter.cpp index 19d88667..f0fda5e0 100644 --- a/Source/RMG-Input/UserInterface/EventFilter.cpp +++ b/Source/RMG-Input/UserInterface/EventFilter.cpp @@ -25,17 +25,19 @@ bool EventFilter::eventFilter(QObject *object, QEvent *event) { case QEvent::Type::KeyPress: { - if (((QKeyEvent *)event)->key() != Qt::Key_Escape) + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() != Qt::Key_Escape) { - emit this->on_EventFilter_KeyPressed((QKeyEvent *)event); + emit this->on_EventFilter_KeyPressed(keyEvent); return true; } } break; case QEvent::Type::KeyRelease: { - if (((QKeyEvent *)event)->key() != Qt::Key_Escape) + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() != Qt::Key_Escape) { - emit this->on_EventFilter_KeyReleased((QKeyEvent *)event); + emit this->on_EventFilter_KeyReleased(keyEvent); return true; } } break; @@ -45,3 +47,4 @@ bool EventFilter::eventFilter(QObject *object, QEvent *event) return QObject::eventFilter(object, event); } +; \ No newline at end of file diff --git a/Source/RMG-Input/UserInterface/HotkeysDialog.cpp b/Source/RMG-Input/UserInterface/HotkeysDialog.cpp index 4a2187a7..92bd7b7b 100644 --- a/Source/RMG-Input/UserInterface/HotkeysDialog.cpp +++ b/Source/RMG-Input/UserInterface/HotkeysDialog.cpp @@ -87,7 +87,7 @@ HotkeysDialog::HotkeysDialog(QWidget* parent, QList hotkey for (size_t y = 0; y < givenMapping.inputTypes.size(); y++) { buttonMapping.button->AddInputData( - (InputType)givenMapping.inputTypes.at(y), + static_cast(givenMapping.inputTypes.at(y)), givenMapping.inputData.at(y), givenMapping.extraInputData.at(y), QString::fromStdString(givenMapping.inputText.at(y)) diff --git a/Source/RMG-Input/UserInterface/MainDialog.cpp b/Source/RMG-Input/UserInterface/MainDialog.cpp index 69f17322..902d1278 100644 --- a/Source/RMG-Input/UserInterface/MainDialog.cpp +++ b/Source/RMG-Input/UserInterface/MainDialog.cpp @@ -355,8 +355,8 @@ void MainDialog::on_EventFilter_KeyPressed(QKeyEvent *event) SDL_KeyboardEvent keyboardEvent; keyboardEvent.down = true; keyboardEvent.type = SDL_EVENT_KEY_DOWN; - keyboardEvent.scancode = (SDL_Scancode)key; - keyboardEvent.key = (SDL_Keycode)key; + keyboardEvent.scancode = static_cast(key); + keyboardEvent.key = static_cast(key); keyboardEvent.mod = mod; SDL_Event sdlEvent; @@ -374,8 +374,8 @@ void MainDialog::on_EventFilter_KeyReleased(QKeyEvent *event) SDL_KeyboardEvent keyboardEvent; keyboardEvent.down = false; keyboardEvent.type = SDL_EVENT_KEY_UP; - keyboardEvent.scancode = (SDL_Scancode)key; - keyboardEvent.key = (SDL_Keycode)key; + keyboardEvent.scancode = static_cast(key); + keyboardEvent.key = static_cast(key); keyboardEvent.mod = mod; SDL_Event sdlEvent; diff --git a/Source/RMG-Input/UserInterface/Widget/ControllerWidget.cpp b/Source/RMG-Input/UserInterface/Widget/ControllerWidget.cpp index 1d8ca9df..f780a06b 100644 --- a/Source/RMG-Input/UserInterface/Widget/ControllerWidget.cpp +++ b/Source/RMG-Input/UserInterface/Widget/ControllerWidget.cpp @@ -266,7 +266,7 @@ void ControllerWidget::disableAllChildren() continue; } - QWidget* widget = (QWidget*)object; + QWidget* widget = static_cast(object); if (widget->isEnabled()) { widget->setEnabled(false); @@ -1049,7 +1049,7 @@ void ControllerWidget::on_MainDialog_SdlEvent(SDL_Event* event) inputType = InputType::GamepadButton; sdlButton = event->gbutton.button; sdlButtonPressed = (event->type == SDL_EVENT_GAMEPAD_BUTTON_DOWN); - sdlButtonName = SDL_GetGamepadStringForButton((SDL_GamepadButton)sdlButton); + sdlButtonName = SDL_GetGamepadStringForButton(static_cast(sdlButton)); } else if ((event->type == SDL_EVENT_JOYSTICK_BUTTON_DOWN) || (event->type == SDL_EVENT_JOYSTICK_BUTTON_UP)) @@ -1303,7 +1303,7 @@ void ControllerWidget::on_MainDialog_SdlEvent(SDL_Event* event) inputType = InputType::GamepadAxis; sdlAxis = event->gaxis.axis; sdlAxisValue = event->gaxis.value; - sdlAxisName = SDL_GetGamepadStringForAxis((SDL_GamepadAxis)sdlAxis); + sdlAxisName = SDL_GetGamepadStringForAxis(static_cast(sdlAxis)); sdlAxisName += sdlAxisValue > 0 ? "+" : "-"; } else @@ -1419,7 +1419,7 @@ void ControllerWidget::on_MainDialog_SdlEvent(SDL_Event* event) break; } - const SDL_Scancode sdlButton = (SDL_Scancode)event->key.scancode; + const SDL_Scancode sdlButton = static_cast(event->key.scancode); const bool sdlButtonPressed = (event->type == SDL_EVENT_KEY_DOWN); // handle button widget @@ -1718,7 +1718,7 @@ void ControllerWidget::LoadSettings(QString sectionQString, bool loadUserProfile // add all input data for (int i = 0; i < count; i++) { - buttonSetting.button->AddInputData((InputType)types[i], data[i], extraData[i], QString::fromStdString(names.at(i))); + buttonSetting.button->AddInputData(static_cast(types[i]), data[i], extraData[i], QString::fromStdString(names.at(i))); } } diff --git a/Source/RMG-Input/UserInterface/Widget/HotkeyButton.cpp b/Source/RMG-Input/UserInterface/Widget/HotkeyButton.cpp index c76cc0e1..7f61b359 100644 --- a/Source/RMG-Input/UserInterface/Widget/HotkeyButton.cpp +++ b/Source/RMG-Input/UserInterface/Widget/HotkeyButton.cpp @@ -173,6 +173,7 @@ void HotkeyButton::on_countDownTimer_triggered() this->currentCountDownNum = 5; this->countDownTimer->stop(); emit this->hotkeysDialog->on_HotkeyButton_TimerFinished(this); + return; } this->currentCountDownNum--;