diff --git a/mainwidget.cpp b/mainwidget.cpp index c532607..b9410d0 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -349,6 +349,9 @@ void TeletextWidget::keyPressEvent(QKeyEvent *event) case Qt::Key_Delete: m_teletextDocument->undoStack()->push(new DeleteKeyCommand(m_teletextDocument)); break; + case Qt::Key_Insert: + emit insertKeyPressed(); + break; case Qt::Key_Up: m_teletextDocument->cursorUp(); diff --git a/mainwidget.h b/mainwidget.h index 52f3c6a..3bee553 100644 --- a/mainwidget.h +++ b/mainwidget.h @@ -55,6 +55,7 @@ public: signals: void sizeChanged(); + void insertKeyPressed(); public slots: void subPageSelected(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 5dcd3c8..db19c1b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -178,11 +178,10 @@ void MainWindow::init() connect(m_textWidget, &TeletextWidget::sizeChanged, this, &MainWindow::setSceneDimensions); connect(m_textWidget->pageRender(), &TeletextPageRender::fullScreenColourChanged, m_textScene, &LevelOneScene::setFullScreenColour); connect(m_textWidget->pageRender(), &TeletextPageRender::fullRowColourChanged, m_textScene, &LevelOneScene::setFullRowColour); + connect(m_textWidget, &TeletextWidget::insertKeyPressed, this, &MainWindow::toggleInsertMode); QShortcut *blockShortCut = new QShortcut(QKeySequence(Qt::Key_Escape, Qt::Key_J), m_textView); connect(blockShortCut, &QShortcut::activated, [=]() { m_textWidget->setCharacter(0x7f); }); - QShortcut *insertModeShortCut = new QShortcut(QKeySequence(Qt::Key_Insert), this); - connect(insertModeShortCut, &QShortcut::activated, this, &MainWindow::toggleInsertMode); setUnifiedTitleAndToolBarOnMac(true);