From cff9127814edb8d54a0b9f8f9aeeae48a5705467 Mon Sep 17 00:00:00 2001 From: mzn Date: Fri, 29 Nov 2013 09:29:14 +0000 Subject: [PATCH] Feature #84: Profiles georeferencement (12.4). Minor corrections. --- src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx | 22 ++++++++----------- src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx | 8 +++---- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx index bd10b2c0..feb21b29 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx @@ -91,16 +91,10 @@ QWidget* HYDROGUI_GeoreferencementDlg::Delegate::createEditor( QWidget* anEditor = 0; if ( theIndex.column() > 0 ) { - QVariant aData = theIndex.data( Qt::DisplayRole ); - QLineEdit* aLineEdit = new QLineEdit( theParent ); aLineEdit->setValidator( new QDoubleValidator( aLineEdit ) ); - aLineEdit->setText( aData.toString() ); - anEditor = aLineEdit; - } - - if ( !anEditor) { + } else { anEditor = QItemDelegate::createEditor( theParent, theOption, theIndex ); } @@ -110,18 +104,20 @@ QWidget* HYDROGUI_GeoreferencementDlg::Delegate::createEditor( void HYDROGUI_GeoreferencementDlg::Delegate::setEditorData( QWidget* theEditor, const QModelIndex& theIndex ) const { - QLineEdit* anEditor = qobject_cast( theEditor ); - if ( anEditor ) { - anEditor->setText( theIndex.data( Qt::EditRole ).toString() ); + if ( QLineEdit* aLineEdit = dynamic_cast( theEditor ) ) { + aLineEdit->setText( theIndex.data( Qt::EditRole ).toString() ); + } else { + QItemDelegate::setEditorData( theEditor, theIndex ); } } void HYDROGUI_GeoreferencementDlg::Delegate::setModelData( QWidget* theEditor, QAbstractItemModel* theModel, const QModelIndex& theIndex) const { - QLineEdit* anEditor = qobject_cast( theEditor ); - if ( anEditor ) { - theModel->setData( theIndex, anEditor->text() ); + if ( QLineEdit* aLineEdit = dynamic_cast( theEditor ) ) { + theModel->setData( theIndex, aLineEdit->text() ); + } else { + QItemDelegate::setModelData( theEditor, theModel, theIndex ); } } diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx index 80a0373e..15595b60 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx @@ -129,13 +129,11 @@ void HYDROGUI_GeoreferencementOp::onModeActivated( const int theActualMode ) if ( !store( anErrorMsg ) ) { aPanel->setMode( theActualMode == HYDROGUI_GeoreferencementDlg::AllProfiles ? HYDROGUI_GeoreferencementDlg::SelectedProfiles : - HYDROGUI_GeoreferencementDlg::AllProfiles ); + HYDROGUI_GeoreferencementDlg::AllProfiles); - if ( anErrorMsg.isEmpty() ) { - anErrorMsg = tr( "INSUFFICIENT_INPUT_DATA" ); - } + anErrorMsg.append( "\n" + tr( "INPUT_VALID_DATA" ) ); SUIT_MessageBox::critical( module()->getApp()->desktop(), - tr( "ERROR" ), + tr( "INSUFFICIENT_INPUT_DATA" ), anErrorMsg ); return; } -- 2.39.2