mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 02:28:51 +00:00
MemoryWidget: Allow 0x prefix when Hex box is checked.
Fix validation failing when the user has checked the Hex box and also includes a "0x" or "-0x" prefix in their input. Previously an extra "0x" would be inserted, causing the user's input of "0x13" to become "0x0x13" which would then fail to validate.
This commit is contained in:
parent
9a0d4501f8
commit
8f4a0b0e77
1 changed files with 9 additions and 2 deletions
|
@ -620,10 +620,17 @@ void MemoryWidget::ValidateAndPreviewInputValue()
|
|||
|
||||
if (m_base_check->isChecked())
|
||||
{
|
||||
// Add 0x to the front of the input (after the '-', if present), but only if the user didn't
|
||||
// already do so.
|
||||
if (input_text.startsWith(QLatin1Char('-')))
|
||||
input_text.insert(1, QStringLiteral("0x"));
|
||||
else
|
||||
{
|
||||
if (!input_text.startsWith(QStringLiteral("-0x"), Qt::CaseInsensitive))
|
||||
input_text.insert(1, QStringLiteral("0x"));
|
||||
}
|
||||
else if (!input_text.startsWith(QStringLiteral("0x"), Qt::CaseInsensitive))
|
||||
{
|
||||
input_text.prepend(QStringLiteral("0x"));
|
||||
}
|
||||
}
|
||||
|
||||
QFont font;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue