diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2018-07-30 11:58:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-30 11:58:47 +0200 |
| commit | 6af7c1fe277ab61a813b516babd8396dc776810e (patch) | |
| tree | 6aaa8855dab02e91c26290c400f763c8d992b8e2 /Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp | |
| parent | 81c3400681e85853ccf352574ead9ffed5d3183f (diff) | |
| parent | f37813d8b69b8dc78502367f279f24fb9ba718a0 (diff) | |
Merge pull request #7273 from Techjar/qt-iowindow-detect-spaces
Qt/IOWindow: Fix detection of button names containing non-alphabetical characters
Diffstat (limited to 'Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp index 49c29d29a7..9bbf1b17a1 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp @@ -14,7 +14,7 @@ namespace MappingCommon { QString GetExpressionForControl(const QString& control_name, const ciface::Core::DeviceQualifier& control_device, - const ciface::Core::DeviceQualifier& default_device) + const ciface::Core::DeviceQualifier& default_device, Quote quote) { QString expr; @@ -28,22 +28,26 @@ QString GetExpressionForControl(const QString& control_name, // append the control name expr += control_name; - QRegExp reg(QStringLiteral("[a-zA-Z]+")); - if (!reg.exactMatch(expr)) - expr = QStringLiteral("`%1`").arg(expr); + if (quote == Quote::On) + { + QRegExp reg(QStringLiteral("[a-zA-Z]+")); + if (!reg.exactMatch(expr)) + expr = QStringLiteral("`%1`").arg(expr); + } + return expr; } QString DetectExpression(ControlReference* reference, ciface::Core::Device* device, - const ciface::Core::DeviceQualifier& default_device) + const ciface::Core::DeviceQualifier& default_device, Quote quote) { ciface::Core::Device::Control* const ctrl = reference->Detect(5000, device); if (ctrl) { return MappingCommon::GetExpressionForControl(QString::fromStdString(ctrl->GetName()), - default_device, default_device); + default_device, default_device, quote); } return QStringLiteral(""); } -} +} // namespace MappingCommon |
