소스 검색

UI: Fix hotkey settings screen not accepting all input on macOS

By default Qt will hand off key events to platform-native input methods
on macOS because the OS or additional software can intercept key input
and transform it (e.g. the international variations popping up when
holding down the key for certain letters).

This functionality can lead to certain key combinations being ignored
because they don't call the delegate methods implemented by Qt to
handle the input after it's been interpreted by the Input Method.

Disabling Input Methods for hotkey input fields fixes this issue, as the
native input methods are bypassed entirely and the key events are
handled by the widget and its keyboard events directly.
PatTheMav 3 년 전
부모
커밋
c01d6bf4f7
2개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      UI/hotkey-edit.cpp
  2. 1 0
      UI/hotkey-edit.hpp

+ 9 - 0
UI/hotkey-edit.cpp

@@ -59,6 +59,15 @@ void OBSHotkeyEdit::keyPressEvent(QKeyEvent *event)
 	HandleNewKey(new_key);
 }
 
+QVariant OBSHotkeyEdit::inputMethodQuery(Qt::InputMethodQuery query) const
+{
+	if (query == Qt::ImEnabled) {
+		return false;
+	} else {
+		return QLineEdit::inputMethodQuery(query);
+	}
+}
+
 #ifdef __APPLE__
 void OBSHotkeyEdit::keyReleaseEvent(QKeyEvent *event)
 {

+ 1 - 0
UI/hotkey-edit.hpp

@@ -98,6 +98,7 @@ public:
 
 	void UpdateDuplicationState();
 	bool hasDuplicate = false;
+	QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
 
 protected:
 	OBSSignal layoutChanged;