[Qt6] Fix shortcut key sequences

This commit is contained in:
G.K.MacGregor
2023-08-22 21:34:10 +01:00
parent e001aa7896
commit 8e14d144fd

View File

@@ -462,17 +462,17 @@ void MainWindow::createActions()
#endif // !QT_NO_CLIPBOARD
QAction *insertBlankRowAct = editMenu->addAction(tr("Insert blank row"));
insertBlankRowAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
insertBlankRowAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_I));
insertBlankRowAct->setStatusTip(tr("Insert a blank row at the cursor position"));
connect(insertBlankRowAct, &QAction::triggered, [=]() { insertRow(false); } );
QAction *insertCopyRowAct = editMenu->addAction(tr("Insert copy row"));
insertCopyRowAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
insertCopyRowAct->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_I));
insertCopyRowAct->setStatusTip(tr("Insert a row that's a copy of the row at the cursor position"));
connect(insertCopyRowAct, &QAction::triggered, [=]() { insertRow(true); } );
QAction *deleteRowAct = editMenu->addAction(tr("Delete row"));
deleteRowAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
deleteRowAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_D));
deleteRowAct->setStatusTip(tr("Delete the row at the cursor position"));
connect(deleteRowAct, &QAction::triggered, this, &MainWindow::deleteRow);
@@ -498,26 +498,26 @@ void MainWindow::createActions()
QAction *revealAct = viewMenu->addAction(tr("&Reveal"));
revealAct->setCheckable(true);
revealAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
revealAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_R));
revealAct->setStatusTip(tr("Toggle reveal"));
connect(revealAct, &QAction::toggled, m_textWidget, &TeletextWidget::setReveal);
QAction *mixAct = viewMenu->addAction(tr("&Mix"));
mixAct->setCheckable(true);
mixAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
mixAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_M));
mixAct->setStatusTip(tr("Toggle mix"));
connect(mixAct, &QAction::toggled, m_textWidget, &TeletextWidget::setMix);
connect(mixAct, &QAction::toggled, m_textScene, &LevelOneScene::setMix);
QAction *gridAct = viewMenu->addAction(tr("&Grid"));
gridAct->setCheckable(true);
gridAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
gridAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_G));
gridAct->setStatusTip(tr("Toggle the text grid"));
connect(gridAct, &QAction::toggled, m_textScene, &LevelOneScene::toggleGrid);
QAction *showControlCodesAct = viewMenu->addAction(tr("Show control codes"));
showControlCodesAct->setCheckable(true);
showControlCodesAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T));
showControlCodesAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T));
showControlCodesAct->setStatusTip(tr("Toggle showing of control codes"));
connect(showControlCodesAct, &QAction::toggled, m_textWidget, &TeletextWidget::setShowControlCodes);
@@ -572,7 +572,7 @@ void MainWindow::createActions()
connect(zoomOutAct, &QAction::triggered, this, &MainWindow::zoomOut);
QAction *zoomResetAct = viewMenu->addAction(tr("Reset zoom"));
zoomResetAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
zoomResetAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0));
zoomResetAct->setStatusTip(tr("Reset zoom level"));
connect(zoomResetAct, &QAction::triggered, this, &MainWindow::zoomReset);
@@ -584,19 +584,19 @@ void MainWindow::createActions()
const char *colours[] = { "Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White" };
QAction *alphaColour = alphaColourSubMenu->addAction(tr(colours[i]));
alphaColour->setShortcut(QKeySequence(Qt::Key_Escape, Qt::Key_0 + i));
alphaColour->setShortcut(QKeySequence(QString("Esc, %1").arg(i)));
alphaColour->setStatusTip(QString("Insert alphanumeric %1 attribute").arg(QString(colours[i]).toLower()));
connect(alphaColour, &QAction::triggered, [=]() { m_textWidget->setCharacter(i); });
QAction *mosaicColour = mosaicColourSubMenu->addAction(tr(colours[i]));
mosaicColour->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_0 + i));
mosaicColour->setShortcut(QKeySequence(QString("Esc, Shift+%1").arg(i)));
mosaicColour->setStatusTip(QString("Insert mosaic %1 attribute").arg(QString(colours[i]).toLower()));
connect(mosaicColour, &QAction::triggered, [=]() { m_textWidget->setCharacter(i+0x10); });
}
QMenu *mosaicsStyleSubMenu = insertMenu->addMenu(tr("Mosaics style"));
QAction *mosaicsSeparatedAct = mosaicsStyleSubMenu->addAction(tr("Separated mosaics"));
mosaicsSeparatedAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_S));
mosaicsSeparatedAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_S));
mosaicsSeparatedAct->setStatusTip(tr("Insert separated mosaics attribute"));
connect(mosaicsSeparatedAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x1a); });
QAction *mosaicsContiguousAct = mosaicsStyleSubMenu->addAction(tr("Contiguous mosaics"));
@@ -606,7 +606,7 @@ void MainWindow::createActions()
QMenu *mosaicsHoldSubMenu = insertMenu->addMenu(tr("Mosaics hold"));
QAction *mosaicsHoldAct = mosaicsHoldSubMenu->addAction(tr("Hold mosaics"));
mosaicsHoldAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_H));
mosaicsHoldAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_H));
mosaicsHoldAct->setStatusTip(tr("Insert hold mosaics attribute"));
connect(mosaicsHoldAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x1e); });
QAction *mosaicsReleaseAct = mosaicsHoldSubMenu->addAction(tr("Release mosaics"));
@@ -616,7 +616,7 @@ void MainWindow::createActions()
QMenu *backgroundColourSubMenu = insertMenu->addMenu(tr("Background colour"));
QAction *backgroundNewAct = backgroundColourSubMenu->addAction(tr("New background"));
backgroundNewAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_N));
backgroundNewAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_N));
backgroundNewAct->setStatusTip(tr("Insert new background attribute"));
connect(backgroundNewAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x1d); });
QAction *backgroundBlackAct = backgroundColourSubMenu->addAction(tr("Black background"));
@@ -630,15 +630,15 @@ void MainWindow::createActions()
textSizeNormalAct->setStatusTip(tr("Insert normal size attribute"));
connect(textSizeNormalAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0c); });
QAction *textSizeDoubleHeightAct = textSizeSubMenu->addAction(tr("Double height"));
textSizeDoubleHeightAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_D));
textSizeDoubleHeightAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_D));
textSizeDoubleHeightAct->setStatusTip(tr("Insert double height attribute"));
connect(textSizeDoubleHeightAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0d); });
QAction *textSizeDoubleWidthAct = textSizeSubMenu->addAction(tr("Double width"));
textSizeDoubleWidthAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::CTRL + Qt::Key_D));
textSizeDoubleWidthAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::CTRL | Qt::Key_D));
textSizeDoubleWidthAct->setStatusTip(tr("Insert double width attribute"));
connect(textSizeDoubleWidthAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0e); });
QAction *textSizeDoubleSizeAct = textSizeSubMenu->addAction(tr("Double size"));
textSizeDoubleSizeAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::CTRL + Qt::SHIFT + Qt::Key_D));
textSizeDoubleSizeAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::CTRL | Qt::SHIFT | Qt::Key_D));
textSizeDoubleSizeAct->setStatusTip(tr("Insert double size attribute"));
connect(textSizeDoubleSizeAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0f); });
@@ -649,7 +649,7 @@ void MainWindow::createActions()
QMenu *flashSubMenu = insertMenu->addMenu(tr("Flash"));
QAction *flashFlashingAct = flashSubMenu->addAction(tr("Flashing"));
flashFlashingAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_F));
flashFlashingAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_F));
flashFlashingAct->setStatusTip(tr("Insert flashing attribute"));
connect(flashFlashingAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x08); });
QAction *flashSteadyAct = flashSubMenu->addAction(tr("Steady"));
@@ -659,7 +659,7 @@ void MainWindow::createActions()
QMenu *boxingSubMenu = insertMenu->addMenu(tr("Box"));
QAction *boxingStartAct = boxingSubMenu->addAction(tr("Start box"));
boxingStartAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::SHIFT + Qt::Key_X));
boxingStartAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::SHIFT | Qt::Key_X));
boxingStartAct->setStatusTip(tr("Insert start box attribute"));
connect(boxingStartAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0b); });
QAction *boxingEndAct = boxingSubMenu->addAction(tr("End box"));
@@ -668,7 +668,7 @@ void MainWindow::createActions()
connect(boxingEndAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x0a); });
QAction *escSwitchAct = insertMenu->addAction(tr("ESC/switch"));
escSwitchAct->setShortcut(QKeySequence(Qt::Key_Escape, Qt::CTRL + Qt::Key_S));
escSwitchAct->setShortcut(QKeySequence(Qt::NoModifier | Qt::Key_Escape, Qt::CTRL | Qt::Key_S));
escSwitchAct->setStatusTip(tr("Insert ESC/switch character set attribute"));
connect(escSwitchAct, &QAction::triggered, [=]() { m_textWidget->setCharacter(0x1b); });