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 );
}
void HYDROGUI_GeoreferencementDlg::Delegate::setEditorData(
QWidget* theEditor, const QModelIndex& theIndex ) const
{
- QLineEdit* anEditor = qobject_cast<QLineEdit*>( theEditor );
- if ( anEditor ) {
- anEditor->setText( theIndex.data( Qt::EditRole ).toString() );
+ if ( QLineEdit* aLineEdit = dynamic_cast<QLineEdit*>( 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<QLineEdit*>( theEditor );
- if ( anEditor ) {
- theModel->setData( theIndex, anEditor->text() );
+ if ( QLineEdit* aLineEdit = dynamic_cast<QLineEdit*>( theEditor ) ) {
+ theModel->setData( theIndex, aLineEdit->text() );
+ } else {
+ QItemDelegate::setModelData( theEditor, theModel, theIndex );
}
}
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;
}