Skip to content
Permalink
Browse files

Remove last traces of obsolete Qt4 API usage (from c++ -- may still b…

…e some in Python!)
  • Loading branch information
nyalldawson committed Feb 6, 2020
1 parent a072393 commit 9fb02d6ba790c296a27bdf3812c747964659db7f
Showing with 103 additions and 94 deletions.
  1. +6 −6 python/core/auto_generated/qgsfeature.sip.in
  2. +1 −1 python/core/auto_generated/qgsfields.sip.in
  3. +1 −1 python/core/auto_generated/qgspointxy.sip.in
  4. +2 −1 src/auth/oauth2/qgsauthoauth2method.cpp
  5. +1 −0 src/auth/oauth2/qgso2.cpp
  6. +2 −2 src/core/auth/qgsauthcertutils.cpp
  7. +1 −0 src/core/providers/memory/qgsmemoryprovider.cpp
  8. +2 −2 src/core/providers/ogr/qgsogrprovider.cpp
  9. +1 −0 src/core/qgsdatasourceuri.cpp
  10. +6 −6 src/core/qgsfeature.h
  11. +1 −1 src/core/qgsfields.h
  12. +3 −3 src/core/qgsnewsfeedparser.cpp
  13. +1 −1 src/core/qgsnewsfeedparser.h
  14. +1 −1 src/core/qgspointxy.h
  15. +2 −2 src/core/qgsrunprocess.cpp
  16. +1 −0 src/core/qgsruntimeprofiler.h
  17. +1 −1 src/crashhandler/qgscrashreport.cpp
  18. +1 −1 src/gui/auth/qgsauthcertificateinfo.cpp
  19. +2 −2 src/gui/auth/qgsauthsslconfigwidget.cpp
  20. +1 −1 src/providers/delimitedtext/qgsdelimitedtextfile.cpp
  21. +1 −0 src/providers/postgres/qgspostgresprojectstorage.cpp
  22. +2 −2 src/providers/postgres/raster/qgspostgresrasterprovider.cpp
  23. +2 −2 src/providers/postgres/raster/qgspostgresrastershareddata.cpp
  24. +1 −0 src/providers/wfs/qgswfscapabilities.cpp
  25. +1 −0 src/providers/wfs/qgswfsdescribefeaturetype.cpp
  26. +1 −0 src/providers/wfs/qgswfsshareddata.cpp
  27. +4 −4 tests/bench/qgsbench.cpp
  28. +1 −1 tests/src/app/testqgsmaptooladdfeatureline.cpp
  29. +1 −1 tests/src/app/testqgsvertextool.cpp
  30. +3 −3 tests/src/core/testqgsauthconfig.cpp
  31. +2 −2 tests/src/core/testqgsauthmanager.cpp
  32. +4 −4 tests/src/core/testqgsgml.cpp
  33. +3 −3 tests/src/core/testqgsmaplayerstylemanager.cpp
  34. +1 −1 tests/src/core/testqgsnewsfeedparser.cpp
  35. +35 −35 tests/src/core/testqgsogcutils.cpp
  36. +2 −2 tests/src/gui/testprocessinggui.cpp
  37. +2 −2 tests/src/providers/grass/testqgsgrassprovider.cpp
@@ -62,7 +62,7 @@ geometry and a list of field/values attributes.
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -97,7 +97,7 @@ geometry and a list of field/values attributes.
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -129,7 +129,7 @@ geometry and a list of field/values attributes.
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -418,7 +418,7 @@ The feature will be valid if it was successful
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -457,7 +457,7 @@ before this method can be used.
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
sipRes = false;
}
@@ -491,7 +491,7 @@ before this method can be used.
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -187,7 +187,7 @@ Gets field with matching name
int fieldIdx = sipCpp->indexFromName( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -263,7 +263,7 @@ Multiply x and y by the given value
else
{
QString msg = QString( "Bad index: %1" ).arg( a0 );
PyErr_SetString( PyExc_IndexError, msg.toAscii().constData() );
PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
}
%End

@@ -36,6 +36,7 @@
#include <QPointer>
#include <QString>
#include <QMutexLocker>
#include <QUrlQuery>


static const QString AUTH_METHOD_KEY = QStringLiteral( "OAuth2" );
@@ -266,7 +267,7 @@ bool QgsAuthOAuth2Method::updateNetworkRequest( QNetworkRequest &request, const
switch ( accessmethod )
{
case QgsAuthOAuth2Config::Header:
request.setRawHeader( O2_HTTP_AUTHORIZATION_HEADER, QStringLiteral( "Bearer %1" ).arg( o2->token() ).toAscii() );
request.setRawHeader( O2_HTTP_AUTHORIZATION_HEADER, QStringLiteral( "Bearer %1" ).arg( o2->token() ).toLatin1() );
#ifdef QGISDEBUG
msg = QStringLiteral( "Updated request HEADER with access token for authcfg: %1" ).arg( authcfg );
QgsDebugMsgLevel( msg, 2 );
@@ -25,6 +25,7 @@
#include <QDir>
#include <QSettings>
#include <QUrl>
#include <QUrlQuery>


QString QgsO2::O2_OAUTH2_STATE = QStringLiteral( "state" );
@@ -41,7 +41,7 @@ QString QgsAuthCertUtils::getSslProtocolName( QSsl::SslProtocol protocol )
return QObject::tr( "SecureProtocols" );
case QSsl::TlsV1SslV3:
return QObject::tr( "TlsV1SslV3" );
case QSsl::TlsV1:
case QSsl::TlsV1_0:
return QObject::tr( "TlsV1" );
case QSsl::SslV3:
return QObject::tr( "SslV3" );
@@ -550,7 +550,7 @@ QList<QSslCertificate> QgsAuthCertUtils::pkcs12BundleCas( const QString &bundlep
{
if ( cert.isCA( ) )
{
result.append( QSslCertificate::fromData( cert.toPEM().toAscii() ) );
result.append( QSslCertificate::fromData( cert.toPEM().toLatin1() ) );
}
}
return result;
@@ -24,6 +24,7 @@
#include "qgscoordinatereferencesystem.h"

#include <QUrl>
#include <QUrlQuery>
#include <QRegExp>

///@cond PRIVATE
@@ -4070,12 +4070,12 @@ static bool IsLocalFile( const QString &path )
( dirName[2] == '\\' || dirName[2] == '/' ) )
{
dirName.resize( 3 );
return GetDriveType( dirName.toAscii().constData() ) != DRIVE_REMOTE;
return GetDriveType( dirName.toLatin1().constData() ) != DRIVE_REMOTE;
}
return true;
#elif defined(Q_OS_LINUX)
struct statfs sStatFS;
if ( statfs( dirName.toAscii().constData(), &sStatFS ) == 0 )
if ( statfs( dirName.toLatin1().constData(), &sStatFS ) == 0 )
{
// Codes from http://man7.org/linux/man-pages/man2/statfs.2.html
if ( sStatFS.f_type == 0x6969 /* NFS */ ||
@@ -25,6 +25,7 @@
#include <QStringList>
#include <QRegExp>
#include <QUrl>
#include <QUrlQuery>

QgsDataSourceUri::QgsDataSourceUri()
{
@@ -96,7 +96,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -131,7 +131,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -163,7 +163,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -425,7 +425,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -457,7 +457,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
sipRes = false;
}
@@ -486,7 +486,7 @@ class CORE_EXPORT QgsFeature
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -219,7 +219,7 @@ class CORE_EXPORT QgsFields
int fieldIdx = sipCpp->indexFromName( *a0 );
if ( fieldIdx == -1 )
{
PyErr_SetString( PyExc_KeyError, a0->toAscii() );
PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
sipIsErr = 1;
}
else
@@ -37,7 +37,7 @@ QgsNewsFeedParser::QgsNewsFeedParser( const QUrl &feedUrl, const QString &authcf

QUrlQuery query( feedUrl );

const uint after = QgsSettings().value( QStringLiteral( "%1/lastFetchTime" ).arg( mSettingsKey ), 0, QgsSettings::Core ).toUInt();
const qint64 after = QgsSettings().value( QStringLiteral( "%1/lastFetchTime" ).arg( mSettingsKey ), 0, QgsSettings::Core ).toUInt();
if ( after > 0 )
query.addQueryItem( QStringLiteral( "after" ), qgsDoubleToString( after, 0 ) );

@@ -138,7 +138,7 @@ void QgsNewsFeedParser::fetch()
QNetworkRequest req( mFeedUrl );
QgsSetRequestInitiatorClass( req, QStringLiteral( "QgsNewsFeedParser" ) );

mFetchStartTime = QDateTime::currentDateTimeUtc().toTime_t();
mFetchStartTime = QDateTime::currentDateTimeUtc().toSecsSinceEpoch();

QgsNetworkContentFetcherTask *task = new QgsNetworkContentFetcherTask( req, mAuthCfg );
task->setDescription( tr( "Fetching News Feed" ) );
@@ -186,7 +186,7 @@ void QgsNewsFeedParser::onFetch( const QString &content )
bool ok = false;
const uint expiry = entryMap.value( QStringLiteral( "publish_to" ) ).toUInt( &ok );
if ( ok )
newEntry.expiry.setTime_t( expiry );
newEntry.expiry.setSecsSinceEpoch( expiry );
newEntries.append( newEntry );

if ( !newEntry.imageUrl.isEmpty() )
@@ -158,7 +158,7 @@ class CORE_EXPORT QgsNewsFeedParser : public QObject
QString mBaseUrl;
QUrl mFeedUrl;
QString mAuthCfg;
uint mFetchStartTime = 0;
qint64 mFetchStartTime = 0;
QString mSettingsKey;

QList< Entry > mEntries;
@@ -358,7 +358,7 @@ class CORE_EXPORT QgsPointXY
else
{
QString msg = QString( "Bad index: %1" ).arg( a0 );
PyErr_SetString( PyExc_IndexError, msg.toAscii().constData() );
PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
}
% End

@@ -40,7 +40,7 @@ QgsRunProcess::QgsRunProcess( const QString &action, bool capture )

if ( capture )
{
connect( mProcess, static_cast < void ( QProcess::* )( QProcess::ProcessError ) >( &QProcess::error ), this, &QgsRunProcess::processError );
connect( mProcess, &QProcess::errorOccurred, this, &QgsRunProcess::processError );
connect( mProcess, &QProcess::readyReadStandardOutput, this, &QgsRunProcess::stdoutAvailable );
connect( mProcess, &QProcess::readyReadStandardError, this, &QgsRunProcess::stderrAvailable );
// We only care if the process has finished if we are capturing
@@ -141,7 +141,7 @@ void QgsRunProcess::dialogGone()

mOutput = nullptr;

disconnect( mProcess, static_cast < void ( QProcess::* )( QProcess::ProcessError ) >( &QProcess::error ), this, &QgsRunProcess::processError );
disconnect( mProcess, &QProcess::errorOccurred, this, &QgsRunProcess::processError );
disconnect( mProcess, &QProcess::readyReadStandardOutput, this, &QgsRunProcess::stdoutAvailable );
disconnect( mProcess, &QProcess::readyReadStandardError, this, &QgsRunProcess::stderrAvailable );
disconnect( mProcess, static_cast < void ( QProcess::* )( int, QProcess::ExitStatus ) >( &QProcess::finished ), this, &QgsRunProcess::processExit );
@@ -20,6 +20,7 @@
#include "qgis_sip.h"
#include <QPair>
#include <QStack>
#include <QList>

#include "qgis_core.h"

@@ -127,7 +127,7 @@ const QString QgsCrashReport::crashID() const
if ( data.isNull() )
return QStringLiteral( "ID not generated due to missing information" );

QString hash = QString( QCryptographicHash::hash( data.toAscii(), QCryptographicHash::Sha1 ).toHex() );
QString hash = QString( QCryptographicHash::hash( data.toLatin1(), QCryptographicHash::Sha1 ).toHex() );
return hash;
}

@@ -580,7 +580,7 @@ void QgsAuthCertInfo::populateInfoDetailsSection()
mCurrentACert.subjectInfo().value( QCA::XMPP ),
LineEdit );

QMultiMap<QSsl::AlternateNameEntryType, QString> alts( mCurrentQCert.subjectAlternativeNames() );
QMultiMap<QSsl::AlternativeNameEntryType, QString> alts( mCurrentQCert.subjectAlternativeNames() );
QStringList altslist;
QString email( tr( "Email: " ) );
QStringList emails( alts.values( QSsl::EmailEntry ) );
@@ -122,8 +122,8 @@ void QgsAuthSslConfigWidget::setUpSslConfigTree()
static_cast<int>( QSsl::SecureProtocols ) );
mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1SslV3 ),
static_cast<int>( QSsl::TlsV1SslV3 ) );
mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1 ),
static_cast<int>( QSsl::TlsV1 ) );
mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1_0 ),
static_cast<int>( QSsl::TlsV1_0 ) );
mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SslV3 ),
static_cast<int>( QSsl::SslV3 ) );
mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SslV2 ),
@@ -28,7 +28,7 @@
#include <QStringList>
#include <QRegExp>
#include <QUrl>

#include <QUrlQuery>

QgsDelimitedTextFile::QgsDelimitedTextFile( const QString &url )
: mFileName( QString() )
@@ -23,6 +23,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QUrl>
#include <QUrlQuery>

static bool _parseMetadataDocument( const QJsonDocument &doc, QgsProjectStorage::Metadata &metadata )
{
@@ -861,7 +861,7 @@ bool QgsPostgresRasterProvider::init()
// Extent
QgsPolygon p;
// Strip \x
const QByteArray hexAscii { result.PQgetvalue( 0, 5 ).toAscii().mid( 2 ) };
const QByteArray hexAscii { result.PQgetvalue( 0, 5 ).toLatin1().mid( 2 ) };
QgsConstWkbPtr ptr { QByteArray::fromHex( hexAscii ) };

if ( ! p.fromWkb( ptr ) )
@@ -1001,7 +1001,7 @@ bool QgsPostgresRasterProvider::init()
// Extent
try
{
QgsConstWkbPtr ptr { QByteArray::fromHex( result.PQgetvalue( 0, 0 ).toAscii() ) };
QgsConstWkbPtr ptr { QByteArray::fromHex( result.PQgetvalue( 0, 0 ).toLatin1() ) };
if ( ! p.fromWkb( ptr ) )
{
QgsMessageLog::logMessage( tr( "Cannot get extent from raster" ),
@@ -138,7 +138,7 @@ QgsPostgresRasterSharedData::TilesResponse QgsPostgresRasterSharedData::tiles( c
}

int dataRead;
GByte *binaryData { CPLHexToBinary( dataResult.PQgetvalue( row, 1 ).toAscii().constData(), &dataRead ) };
GByte *binaryData { CPLHexToBinary( dataResult.PQgetvalue( row, 1 ).toLatin1().constData(), &dataRead ) };
Tile const *tilePtr { setTileData( request.overviewFactor, tileId, QByteArray::fromRawData( reinterpret_cast<char *>( binaryData ), dataRead ) ) };
CPLFree( binaryData );

@@ -332,7 +332,7 @@ QgsPostgresRasterSharedData::TilesResponse QgsPostgresRasterSharedData::fetchTil
);

int dataRead;
GByte *binaryData { CPLHexToBinary( dataResult.PQgetvalue( row, 11 ).toAscii().constData(), &dataRead ) };
GByte *binaryData { CPLHexToBinary( dataResult.PQgetvalue( row, 11 ).toLatin1().constData(), &dataRead ) };
const QVariantMap parsedData { QgsPostgresRasterUtils::parseWkb( QByteArray::fromRawData( reinterpret_cast<char *>( binaryData ), dataRead ) ) };
CPLFree( binaryData );
for ( int bandCnt = 1; bandCnt <= tile->numBands; ++bandCnt )
@@ -26,6 +26,7 @@

#include <QDomDocument>
#include <QStringList>
#include <QUrlQuery>

QgsWfsCapabilities::QgsWfsCapabilities( const QString &uri, const QgsDataProvider::ProviderOptions &options )
: QgsWfsRequest( QgsWFSDataSourceURI( uri ) ),
@@ -15,6 +15,7 @@

#include "qgswfsdescribefeaturetype.h"
#include "qgsmessagelog.h"
#include <QUrlQuery>

QgsWFSDescribeFeatureType::QgsWFSDescribeFeatureType( QgsWFSDataSourceURI &uri )
: QgsWfsRequest( uri )
@@ -20,6 +20,7 @@
#include "qgsexpression.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"
#include <QUrlQuery>

QgsWFSSharedData::QgsWFSSharedData( const QString &uri )
: QgsBackgroundCachedSharedData( "wfs", tr( "WFS" ) )

0 comments on commit 9fb02d6

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