diff --git a/src/fgt/edit_quality/const_types.h b/src/fgt/edit_quality/const_types.h index bde67aeb8..7c825073e 100644 --- a/src/fgt/edit_quality/const_types.h +++ b/src/fgt/edit_quality/const_types.h @@ -20,9 +20,10 @@ typedef unsigned int UINT32; #define MARKERS_RADIUS 2.0f #define REMOVE_TF_HANDLE 0x00000001 -#define REMOVE_EQ_HANDLE 0x00000010 -#define REMOVE_TF_BG 0x00000100 -#define REMOVE_TF_LINES 0x00001000 +#define REMOVE_TF_BG 0x00000010 +#define REMOVE_TF_LINES 0x00000100 +#define REMOVE_TF_ALL (REMOVE_TF_HANDLE | REMOVE_TF_BG | REMOVE_TF_LINES) +#define REMOVE_EQ_HANDLE 0x00001000 #define REMOVE_HISTOGRAM 0x00010000 #define DELETE_REMOVED_ITEMS 0x00100000 #define DO_NOT_DELETE_REMOVED_ITEMS 0x11011111 diff --git a/src/fgt/edit_quality/qualitymapperdialog.cpp b/src/fgt/edit_quality/qualitymapperdialog.cpp index 876a0b25e..b5bcb273d 100644 --- a/src/fgt/edit_quality/qualitymapperdialog.cpp +++ b/src/fgt/edit_quality/qualitymapperdialog.cpp @@ -183,6 +183,7 @@ GRAPHICS_ITEMS_LIST* QualityMapperDialog::clearItems(int toClear) _transferFunctionScene.removeItem( item ); _removed_items << item; } + _transferFunctionLines.clear(); } if ((toClear & REMOVE_HISTOGRAM) == REMOVE_HISTOGRAM) @@ -600,11 +601,13 @@ void QualityMapperDialog::drawTransferFunction() { current_item = _transferFunctionScene.addLine(previousPoint.x(), previousPoint.y(), pointToRepresentLeft.x(), pointToRepresentLeft.y(), drawingPen); current_item->setZValue( zValue ); + _transferFunctionLines << current_item; if ( pointToRepresentLeft.y() != pointRectRight.y() ) { current_item = _transferFunctionScene.addLine( pointToRepresentLeft.x(), pointToRepresentLeft.y(), pointToRepresentRight.x(), pointToRepresentRight.y(), drawingPen ); current_item->setZValue( zValue); + _transferFunctionLines << current_item; } } @@ -680,6 +683,8 @@ void QualityMapperDialog::on_savePresetButton_clicked() KNOWN_EXTERNAL_TFS newTF( tfPath, tfName ); _knownExternalTFs << newTF; _isTransferFunctionInitialized = false; + + this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS ); this->initTF(); ui.presetComboBox->setCurrentIndex( 0 ); } @@ -708,6 +713,7 @@ void QualityMapperDialog::on_loadPresetButton_clicked() _knownExternalTFs << newTF; _isTransferFunctionInitialized = false; + this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS ); this->initTF(); ui.presetComboBox->setCurrentIndex( 0 ); this->drawTransferFunction(); @@ -726,6 +732,7 @@ void QualityMapperDialog::on_presetComboBox_textChanged(const QString &newValue) delete _transferFunction; _transferFunction = new TransferFunction( (DEFAULT_TRANSFER_FUNCTIONS)i ); + this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS ); this->drawTransferFunction(); return ; } @@ -743,6 +750,7 @@ void QualityMapperDialog::on_presetComboBox_textChanged(const QString &newValue) delete _transferFunction; _transferFunction = new TransferFunction( (DEFAULT_TRANSFER_FUNCTIONS)i ); + this->clearItems( REMOVE_TF_ALL | DELETE_REMOVED_ITEMS ); this->drawTransferFunction(); return ; }