diff --git a/mainwidget.cpp b/mainwidget.cpp index ec8a1f9..ed91490 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -384,8 +384,7 @@ void TeletextWidget::setCharacter(unsigned char newCharacter) void TeletextWidget::toggleCharacterBit(unsigned char bitToToggle) { - QUndoCommand *toggleMosaicBitCommand = new ToggleMosaicBitCommand(m_teletextDocument, bitToToggle); - m_teletextDocument->undoStack()->push(toggleMosaicBitCommand); + m_teletextDocument->undoStack()->push(new ToggleMosaicBitCommand(m_teletextDocument, bitToToggle)); } QPair TeletextWidget::mouseToRowAndColumn(const QPoint &mousePosition) diff --git a/mainwindow.cpp b/mainwindow.cpp index 4fa0991..83f816a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -577,20 +577,17 @@ void MainWindow::insertRow(bool copyRow) { if (m_textWidget->document()->cursorRow() == 24) return; - QUndoCommand *insertRowCommand = new InsertRowCommand(m_textWidget->document(), copyRow); - m_textWidget->document()->undoStack()->push(insertRowCommand); + m_textWidget->document()->undoStack()->push(new InsertRowCommand(m_textWidget->document(), copyRow)); } void MainWindow::deleteRow() { - QUndoCommand *deleteRowCommand = new DeleteRowCommand(m_textWidget->document()); - m_textWidget->document()->undoStack()->push(deleteRowCommand); + m_textWidget->document()->undoStack()->push(new DeleteRowCommand(m_textWidget->document())); } void MainWindow::insertSubPage(bool afterCurrentSubPage, bool copyCurrentSubPage) { - QUndoCommand *insertSubPageCommand = new InsertSubPageCommand(m_textWidget->document(), afterCurrentSubPage, copyCurrentSubPage); - m_textWidget->document()->undoStack()->push(insertSubPageCommand); + m_textWidget->document()->undoStack()->push(new InsertSubPageCommand(m_textWidget->document(), afterCurrentSubPage, copyCurrentSubPage)); } void MainWindow::deleteSubPage() diff --git a/palettedockwidget.cpp b/palettedockwidget.cpp index 99180eb..543fa41 100644 --- a/palettedockwidget.cpp +++ b/palettedockwidget.cpp @@ -108,14 +108,11 @@ void PaletteDockWidget::selectColour(int colourIndex) { const QColor newColour = QColorDialog::getColor(m_parentMainWidget->document()->currentSubPage()->CLUTtoQColor(colourIndex), this, "Select Colour"); - if (newColour.isValid()) { - QUndoCommand *setColourCommand = new SetColourCommand(m_parentMainWidget->document(), colourIndex, ((newColour.red() & 0xf0) << 4) | (newColour.green() & 0xf0) | ((newColour.blue() & 0xf0) >> 4)); - m_parentMainWidget->document()->undoStack()->push(setColourCommand); - } + if (newColour.isValid()) + m_parentMainWidget->document()->undoStack()->push(new SetColourCommand(m_parentMainWidget->document(), colourIndex, ((newColour.red() & 0xf0) << 4) | (newColour.green() & 0xf0) | ((newColour.blue() & 0xf0) >> 4))); } void PaletteDockWidget::resetCLUT(int colourTable) { - QUndoCommand *resetCLUTCommand = new ResetCLUTCommand(m_parentMainWidget->document(), colourTable); - m_parentMainWidget->document()->undoStack()->push(resetCLUTCommand); + m_parentMainWidget->document()->undoStack()->push(new ResetCLUTCommand(m_parentMainWidget->document(), colourTable)); }