Skip to content
Permalink
Browse files

Make QgsDxfExport Qt6 ready

  • Loading branch information
m-kuhn authored and nyalldawson committed Mar 25, 2021
1 parent 929b708 commit a379e1e61001664b836e436adb5451f44ac0b022
Showing with 32 additions and 0 deletions.
  1. +12 −0 python/core/auto_generated/dxf/qgsdxfexport.sip.in
  2. +12 −0 src/core/dxf/qgsdxfexport.cpp
  3. +8 −0 src/core/dxf/qgsdxfexport.h
@@ -302,6 +302,18 @@ Write a tuple of group code and integer value
:param code: group code
:param i: integer value

.. note::

available in Python bindings as writeGroupInt
%End

void writeGroup( int code, long long i ) /PyName=writeGroupLong/;
%Docstring
Write a tuple of group code and long value

:param code: group code
:param i: integer value

.. note::

available in Python bindings as writeGroupInt
@@ -105,6 +105,12 @@ void QgsDxfExport::writeGroup( int code, int i )
writeInt( i );
}

void QgsDxfExport::writeGroup( int code, long long i )
{
writeGroupCode( code );
writeInt( i );
}

void QgsDxfExport::writeGroup( int code, double d )
{
writeGroupCode( code );
@@ -190,7 +196,11 @@ QgsDxfExport::ExportResult QgsDxfExport::writeToFile( QIODevice *d, const QStrin
}

mTextStream.setDevice( d );
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
mTextStream.setCodec( encoding.toLocal8Bit() );
#else
mTextStream.setEncoding( QStringConverter::encodingForName( encoding.toLocal8Bit() ).value_or( QStringConverter::Utf8 ) );
#endif

if ( mCrs.isValid() )
mMapSettings.setDestinationCrs( mCrs );
@@ -1488,12 +1498,14 @@ void QgsDxfExport::writeText( const QString &layer, const QString &text, const Q

void QgsDxfExport::writeMText( const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color )
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if ( !mTextStream.codec()->canEncode( text ) )
{
// TODO return error
QgsDebugMsg( QStringLiteral( "could not encode:%1" ).arg( text ) );
return;
}
#endif

writeGroup( 0, QStringLiteral( "MTEXT" ) );
writeHandle();
@@ -332,6 +332,14 @@ class CORE_EXPORT QgsDxfExport : public QgsLabelSink
*/
void writeGroup( int code, int i ) SIP_PYNAME( writeGroupInt );

/**
* Write a tuple of group code and long value
* \param code group code
* \param i integer value
* \note available in Python bindings as writeGroupInt
*/
void writeGroup( int code, long long i ) SIP_PYNAME( writeGroupLong );

/**
* Write a group code with a floating point value
* \param code group code

0 comments on commit a379e1e

Please sign in to comment.