Compact allocating and pushing of commands
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user