Implement draggable rectangle selection

This commit is contained in:
G.K.MacGregor
2020-10-25 11:07:04 +00:00
parent af5f0ae74c
commit 151d842bc0
4 changed files with 91 additions and 16 deletions

View File

@@ -38,6 +38,7 @@ TeletextDocument::TeletextDocument()
m_undoStack = new QUndoStack(this);
m_cursorRow = 1;
m_cursorColumn = 0;
m_selectionSubPage = nullptr;
}
TeletextDocument::~TeletextDocument()
@@ -285,6 +286,23 @@ void TeletextDocument::moveCursor(int newCursorRow, int newCursorColumn)
emit cursorMoved();
}
void TeletextDocument::setSelection(int topRow, int leftColumn, int bottomRow, int rightColumn)
{
if (m_selectionTopRow != topRow || m_selectionBottomRow != bottomRow || m_selectionLeftColumn != leftColumn || m_selectionRightColumn != rightColumn) {
m_selectionSubPage = currentSubPage();
m_selectionTopRow = topRow;
m_selectionBottomRow = bottomRow;
m_selectionLeftColumn = leftColumn;
m_selectionRightColumn = rightColumn;
emit selectionMoved();
}
}
void TeletextDocument::cancelSelection()
{
m_selectionSubPage = nullptr;
}
OverwriteCharacterCommand::OverwriteCharacterCommand(TeletextDocument *teletextDocument, unsigned char newCharacter, QUndoCommand *parent) : QUndoCommand(parent)
{