From 53fb6f0aad9b7b2a7ce149da6dd22369c10e6a06 Mon Sep 17 00:00:00 2001 From: Gavin MacGregor Date: Tue, 25 Nov 2025 19:09:56 +0000 Subject: [PATCH] Implement select all --- src/qteletextmaker/mainwidget.cpp | 5 +++++ src/qteletextmaker/mainwidget.h | 2 ++ src/qteletextmaker/mainwindow.cpp | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/src/qteletextmaker/mainwidget.cpp b/src/qteletextmaker/mainwidget.cpp index df8d9db..4f0611e 100644 --- a/src/qteletextmaker/mainwidget.cpp +++ b/src/qteletextmaker/mainwidget.cpp @@ -539,6 +539,11 @@ void TeletextWidget::paste() m_teletextDocument->undoStack()->push(new PasteCommand(m_teletextDocument, m_pageDecode.level1CharSet(m_teletextDocument->cursorRow(), m_teletextDocument->cursorColumn()))); } +void TeletextWidget::selectAll() +{ + m_teletextDocument->setSelection((int)!m_teletextDocument->rowZeroAllowed(), 0, 24, 39); +} + QPair TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition) { int row = mousePosition.y() / 10; diff --git a/src/qteletextmaker/mainwidget.h b/src/qteletextmaker/mainwidget.h index 172172e..e312db3 100644 --- a/src/qteletextmaker/mainwidget.h +++ b/src/qteletextmaker/mainwidget.h @@ -82,6 +82,8 @@ public slots: void copy(); void paste(); + void selectAll(); + void changeSize(); protected: diff --git a/src/qteletextmaker/mainwindow.cpp b/src/qteletextmaker/mainwindow.cpp index 997ec07..3f56178 100644 --- a/src/qteletextmaker/mainwindow.cpp +++ b/src/qteletextmaker/mainwindow.cpp @@ -637,6 +637,13 @@ void MainWindow::createActions() editMenu->addAction(pasteAct); editToolBar->addAction(pasteAct); + const QIcon selectAllIcon = QIcon::fromTheme("edit-select-all"); + QAction *selectAllAct = new QAction(selectAllIcon, tr("Select &all"), this); + selectAllAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_A)); + selectAllAct->setStatusTip(tr("Select the whole subpage")); + connect(selectAllAct, &QAction::triggered, m_textWidget, &TeletextWidget::selectAll); + editMenu->addAction(selectAllAct); + QAction *copyImageAct = editMenu->addAction(tr("Copy as image")); copyImageAct->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C)); copyImageAct->setStatusTip(tr("Copy this subpage as an image to the clipboard"));