Implement select all

This commit is contained in:
Gavin MacGregor
2025-11-25 19:09:56 +00:00
parent eea73592f9
commit 53fb6f0aad
3 changed files with 14 additions and 0 deletions

View File

@@ -539,6 +539,11 @@ void TeletextWidget::paste()
m_teletextDocument->undoStack()->push(new PasteCommand(m_teletextDocument, m_pageDecode.level1CharSet(m_teletextDocument->cursorRow(), m_teletextDocument->cursorColumn()))); 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<int, int> TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition) QPair<int, int> TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition)
{ {
int row = mousePosition.y() / 10; int row = mousePosition.y() / 10;

View File

@@ -82,6 +82,8 @@ public slots:
void copy(); void copy();
void paste(); void paste();
void selectAll();
void changeSize(); void changeSize();
protected: protected:

View File

@@ -637,6 +637,13 @@ void MainWindow::createActions()
editMenu->addAction(pasteAct); editMenu->addAction(pasteAct);
editToolBar->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")); QAction *copyImageAct = editMenu->addAction(tr("Copy as image"));
copyImageAct->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C)); copyImageAct->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_C));
copyImageAct->setStatusTip(tr("Copy this subpage as an image to the clipboard")); copyImageAct->setStatusTip(tr("Copy this subpage as an image to the clipboard"));