Skip to content
Permalink
Browse files

Vertex editor: make displayed coordinate precision configurable

  • Loading branch information
mhugent committed Nov 2, 2020
1 parent 47a08a4 commit d49d4585d95cf0f2084e2328f73fcc6bfe0e26a7
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/app/vertextool/qgsvertexeditor.cpp
@@ -477,7 +477,8 @@ CoordinateItemDelegate::CoordinateItemDelegate( QObject *parent )

QString CoordinateItemDelegate::displayText( const QVariant &value, const QLocale &locale ) const
{
return locale.toString( value.toDouble(), 'f', 4 );
int dp = QgsProject::instance()->readNumEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/DecimalPlaces" ), 4 );
return locale.toString( value.toDouble(), 'f', dp );
}

QWidget *CoordinateItemDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index ) const
@@ -504,6 +505,7 @@ void CoordinateItemDelegate::setEditorData( QWidget *editor, const QModelIndex &
QLineEdit *lineEdit = qobject_cast<QLineEdit *>( editor );
if ( lineEdit && index.isValid() )
{
lineEdit->setText( QLocale().toString( index.data( ).toDouble( ), 'f', 4 ) );
int dp = QgsProject::instance()->readNumEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/DecimalPlaces" ), 4 );
lineEdit->setText( QLocale().toString( index.data( ).toDouble( ), 'f', dp ) );
}
}

0 comments on commit d49d458

Please sign in to comment.
You can’t perform that action at this time.