mirror of https://github.com/PCSX2/pcsx2.git
Debugger: Run the tables keybind handler before the widgets
This fixes the issue of 'G' executing the go-to box instead of putting it into the text view
This commit is contained in:
parent
68b2fee9be
commit
b994d0ad70
|
@ -243,10 +243,12 @@ void MemoryViewTable::InsertAtCurrentSelection(const QString& text) {
|
|||
}
|
||||
|
||||
// We need both key and keychar because `key` is easy to use, but is case insensitive
|
||||
void MemoryViewTable::KeyPress(int key, QChar keychar)
|
||||
bool MemoryViewTable::KeyPress(int key, QChar keychar)
|
||||
{
|
||||
if (!m_cpu->isValidAddress(selectedAddress))
|
||||
return;
|
||||
return false;
|
||||
|
||||
bool pressHandled = false;
|
||||
|
||||
const bool keyCharIsText = keychar.isLetterOrNumber() || keychar.isSpace();
|
||||
|
||||
|
@ -258,6 +260,7 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
|
|||
cpu->write8(address, val);
|
||||
QtHost::RunOnUIThread([this] { UpdateSelectedAddress(selectedAddress + 1); parent->update(); });
|
||||
});
|
||||
pressHandled = true;
|
||||
}
|
||||
|
||||
switch (key)
|
||||
|
@ -268,12 +271,17 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
|
|||
cpu->write8(address, 0);
|
||||
QtHost::RunOnUIThread([this] { UpdateSelectedAddress(selectedAddress - 1); parent->update(); });
|
||||
});
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_Right:
|
||||
UpdateSelectedAddress(selectedAddress + 1);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_Left:
|
||||
UpdateSelectedAddress(selectedAddress - 1);
|
||||
pressHandled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -283,11 +291,14 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
|
|||
|
||||
if (keyCharIsText)
|
||||
{
|
||||
InsertIntoSelectedHexView(((u8)QString(QChar(key)).toInt(nullptr, 16)));
|
||||
InsertIntoSelectedHexView(((u8)QString(QChar(key)).toInt(&pressHandled, 16)));
|
||||
if (pressHandled)
|
||||
{
|
||||
// Increment to the next nibble or byte
|
||||
if ((selectedNibbleHI = !selectedNibbleHI))
|
||||
UpdateSelectedAddress(selectedAddress + 1);
|
||||
}
|
||||
}
|
||||
|
||||
switch (key)
|
||||
{
|
||||
|
@ -297,14 +308,19 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
|
|||
// Move back a byte or nibble if it's backspace being pressed
|
||||
if (!(selectedNibbleHI = !selectedNibbleHI))
|
||||
UpdateSelectedAddress(selectedAddress - 1);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_Right:
|
||||
if ((selectedNibbleHI = !selectedNibbleHI))
|
||||
UpdateSelectedAddress(selectedAddress + 1);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_Left:
|
||||
if (!(selectedNibbleHI = !selectedNibbleHI))
|
||||
UpdateSelectedAddress(selectedAddress - 1);
|
||||
pressHandled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -315,17 +331,25 @@ void MemoryViewTable::KeyPress(int key, QChar keychar)
|
|||
{
|
||||
case Qt::Key::Key_Up:
|
||||
UpdateSelectedAddress(selectedAddress - 0x10);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_PageUp:
|
||||
UpdateSelectedAddress(selectedAddress - (0x10 * rowVisible), true);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_Down:
|
||||
UpdateSelectedAddress(selectedAddress + 0x10);
|
||||
pressHandled = true;
|
||||
break;
|
||||
case Qt::Key::Key_PageDown:
|
||||
UpdateSelectedAddress(selectedAddress + (0x10 * rowVisible), true);
|
||||
pressHandled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return pressHandled;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -501,7 +525,8 @@ void MemoryViewWidget::wheelEvent(QWheelEvent* event)
|
|||
|
||||
void MemoryViewWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
bool handledByWidget = true;
|
||||
if (!m_table.KeyPress(event->key(), event->text().size() ? event->text()[0] : '\0'))
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_G:
|
||||
|
@ -510,17 +535,11 @@ void MemoryViewWidget::keyPressEvent(QKeyEvent* event)
|
|||
case Qt::Key_C:
|
||||
if (event->modifiers() & Qt::ControlModifier)
|
||||
contextCopySegment();
|
||||
else
|
||||
handledByWidget = false;
|
||||
break;
|
||||
default:
|
||||
handledByWidget = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!handledByWidget)
|
||||
m_table.KeyPress(event->key(), event->text().size() ? event->text()[0] : '\0');
|
||||
|
||||
}
|
||||
this->repaint();
|
||||
VMUpdate();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ public:
|
|||
void SelectAt(QPoint pos);
|
||||
u128 GetSelectedSegment();
|
||||
void InsertAtCurrentSelection(const QString& text);
|
||||
void KeyPress(int key, QChar keychar);
|
||||
// Returns true if the keypress was handled
|
||||
bool KeyPress(int key, QChar keychar);
|
||||
|
||||
MemoryViewType GetViewType()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue