Skip to content

Commit

Permalink
Merge pull request #37135 from elpaso/bugfix-gh29682-vertex-editor-lo…
Browse files Browse the repository at this point in the history
…cale

Fix editor vertex with "non-dot" locales
  • Loading branch information
elpaso committed Jun 12, 2020
2 parents 6bd364e + fb99471 commit cda2839
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/vertextool/qgsvertexeditor.cpp
Expand Up @@ -499,4 +499,11 @@ void CoordinateItemDelegate::setModelData( QWidget *editor, QAbstractItemModel *
}
}


void CoordinateItemDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const
{
QLineEdit *lineEdit = qobject_cast<QLineEdit *>( editor );
if ( lineEdit && index.isValid() )
{
lineEdit->setText( QLocale().toString( index.data( ).toDouble( ), 'f', 4 ) );
}
}
3 changes: 3 additions & 0 deletions src/app/vertextool/qgsvertexeditor.h
Expand Up @@ -140,6 +140,9 @@ class APP_EXPORT CoordinateItemDelegate : public QStyledItemDelegate
protected:
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem & /*option*/, const QModelIndex &index ) const override;
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
void setEditorData( QWidget *editor, const QModelIndex &index ) const override;
};



#endif // QGSVERTEXEDITOR_H

0 comments on commit cda2839

Please sign in to comment.