update keyboard shortcuts

This commit is contained in:
2026-06-23 21:43:34 +02:00
parent f818c90af0
commit 31a8915b0f
9 changed files with 151 additions and 81 deletions

View File

@@ -583,27 +583,29 @@ std::optional<ShipLayoutConfig> ShipLayoutDialog::result() const
void ShipLayoutDialog::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Q)
if (event->key() == Qt::Key_R)
{
// Rotate CCW = 3 CW steps.
switch (m_currentRotation)
if (event->modifiers() & Qt::ShiftModifier)
{
case Rotation::East: m_currentRotation = Rotation::North; break;
case Rotation::North: m_currentRotation = Rotation::West; break;
case Rotation::West: m_currentRotation = Rotation::South; break;
case Rotation::South: m_currentRotation = Rotation::East; break;
// Shift+R: rotate CW.
switch (m_currentRotation)
{
case Rotation::East: m_currentRotation = Rotation::South; break;
case Rotation::South: m_currentRotation = Rotation::West; break;
case Rotation::West: m_currentRotation = Rotation::North; break;
case Rotation::North: m_currentRotation = Rotation::East; break;
}
}
updateGridWidget();
}
else if (event->key() == Qt::Key_E)
{
// Rotate CW.
switch (m_currentRotation)
else
{
case Rotation::East: m_currentRotation = Rotation::South; break;
case Rotation::South: m_currentRotation = Rotation::West; break;
case Rotation::West: m_currentRotation = Rotation::North; break;
case Rotation::North: m_currentRotation = Rotation::East; break;
// R: rotate CCW.
switch (m_currentRotation)
{
case Rotation::East: m_currentRotation = Rotation::North; break;
case Rotation::North: m_currentRotation = Rotation::West; break;
case Rotation::West: m_currentRotation = Rotation::South; break;
case Rotation::South: m_currentRotation = Rotation::East; break;
}
}
updateGridWidget();
}