Commit 0e144849 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use -DQT_NO_CAST_FROM_BYTEARRAY (and adapt some code)

parent 570a430b
......@@ -219,6 +219,7 @@ add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_STRICT_ITERATORS
)
......
......@@ -213,7 +213,7 @@ void AbstractDataPlugin::handleViewportChange( const ViewportParams *viewport )
context->setContextObject( item );
QList<QByteArray> const dynamicProperties = item->dynamicPropertyNames();
foreach( const QByteArray &property, dynamicProperties ) {
context->setContextProperty( property, item->property( property ) );
context->setContextProperty(property, item->property(property.constData()));
}
QObject* component = d->m_delegate->create( context );
......
......@@ -228,7 +228,7 @@ QVariant FavoritesModel::data( const QModelIndex &index, int role ) const
if ( item->initialized() && item->isFavorite() ) {
if ( count == row ) {
QString const roleName = roleNames().value( role );
return item->property( roleName.toLatin1() );
return item->property(roleName.toLatin1().constData());
}
++count;
}
......
......@@ -385,15 +385,15 @@ QList<QStandardItem *> MapThemeManager::Private::createMapThemeRow( QString cons
QIcon mapThemeIcon = QIcon( themeIconPixmap );
QString name = mapTheme->head()->name();
QString description = mapTheme->head()->description();
const QByteArray description = mapTheme->head()->description().toUtf8();
QStandardItem *item = new QStandardItem( name );
item->setData( QCoreApplication::translate("DGML", name.toUtf8() ), Qt::DisplayRole );
item->setData(QCoreApplication::translate("DGML", name.toUtf8().constData()), Qt::DisplayRole);
item->setData( mapThemeIcon, Qt::DecorationRole );
item->setData( QString( "<span style=\" max-width: 150 px;\"> "
+ QCoreApplication::translate("DGML", description.toUtf8() ) + " </span>" ), Qt::ToolTipRole );
+ QCoreApplication::translate("DGML", description.constData()) + " </span>"), Qt::ToolTipRole );
item->setData( mapThemeID, Qt::UserRole + 1 );
item->setData( QCoreApplication::translate("DGML", description.toUtf8() ), Qt::UserRole + 2 );
item->setData(QCoreApplication::translate("DGML", description.constData()), Qt::UserRole + 2);
itemList << item;
......
......@@ -251,7 +251,7 @@ void MarbleLegendBrowser::translateHtml( QString & html )
QStringList::const_iterator i = words.constBegin();
QStringList::const_iterator const end = words.constEnd();
for (; i != end; ++i )
html.replace( *i, QCoreApplication::translate("Legends", (*i).toUtf8() ) );
html.replace(*i, QCoreApplication::translate("Legends", (*i).toUtf8().constData()));
}
void MarbleLegendBrowser::reverseSupportCheckboxes(QString &html)
......
......@@ -84,7 +84,7 @@ void TileCreatorDialog::setProgress( int progress )
void TileCreatorDialog::setSummary( const QString& name,
const QString& description )
{
const QString summary = "<B>" + QCoreApplication::translate("DGML", name.toUtf8() ) + "</B><BR>" + QCoreApplication::translate("DGML", description.toUtf8() );
const QString summary = "<b>" + QCoreApplication::translate("DGML", name.toUtf8().constData()) + "</b><br>" + QCoreApplication::translate("DGML", description.toUtf8().constData());
d->uiWidget.descriptionLabel->setText( summary );
}
......
......@@ -74,7 +74,7 @@ void DeclarativeDataPluginPrivate::parseChunk( DeclarativeDataPluginItem *item,
} else if( key == "alt" || key == "altitude" ) {
coordinates.setAltitude( value.toDouble() );
} else {
item->setProperty( key.toLatin1(), value );
item->setProperty(key.toLatin1().constData(), value);
}
}
......
......@@ -94,7 +94,7 @@ void OpenCachingComItem::showInfoDialog()
// basic details
QString details = "<table><tr><td colspan=\"2\" valign=\"middle\">"
+ tr(m_cache["type"].toString().toUtf8())
+ tr(m_cache["type"].toString().toUtf8().constData())
+ "<br/>" + id() + "<br/>" + coordinate().toString() + "</td></tr>"
+ "<tr><td align=\"right\">" + tr("Size:") + " </td><td>" + ratingNumberString(m_cache["size"]) + "</td></tr>"
+ "<tr><td align=\"right\">" + tr("Difficulty:") + " </td><td>" + ratingNumberString(m_cache["difficulty"]) + "</td></tr>"
......@@ -116,7 +116,7 @@ void OpenCachingComItem::showInfoDialog()
{
strTags += ", ";
}
strTags += tr(tags[i].toUtf8());
strTags += tr(tags[i].toUtf8().constData());
}
m_cache["strTags"] = strTags;
}
......@@ -252,7 +252,7 @@ void OpenCachingComItem::updateTooltip()
html += "<tr><td colspan=\"2\"><table cellpadding=\"3\"><tr><td><img src=\":/" + iconName() + "\"></td>"
+ "<td valign=\"middle\"><big><strong>" + m_cache["name"].toString() + "</strong></big></td></tr></table></td></tr>"
+ "<tr><td align=\"left\">"
+ tr(m_cache["type"].toString().toUtf8())
+ tr(m_cache["type"].toString().toUtf8().constData())
+ "<br/>" + tr( "by <em>" ) + m_cache["hidden_by"].toMap()["name"].toString() + "</em>"
+ "<br/>" + coordinate().lonToString()
+ "<br/>" + coordinate().latToString()
......
......@@ -85,7 +85,7 @@ void O5mWriter::writeNodes(const OsmConverter::Nodes &nodes, QDataStream &stream
writeTags(osmData, stringTable, bufferStream);
writeUnsigned(buffer.size(), stream);
stream.writeRawData(buffer.data(), buffer.size());
stream.writeRawData(buffer.data().constData(), buffer.size());
lastId = osmData.id();
lastLon = lon;
......@@ -127,12 +127,12 @@ void O5mWriter::writeWays(const OsmConverter::Ways &ways, QDataStream &stream) c
QDataStream referencesStream(&referencesBuffer);
writeReferences(*way.first, lastReferenceId, osmData, referencesStream);
writeUnsigned(referencesBuffer.size(), bufferStream);
bufferStream.writeRawData(referencesBuffer.data(), referencesBuffer.size());
bufferStream.writeRawData(referencesBuffer.data().constData(), referencesBuffer.size());
writeTags(osmData, stringTable, bufferStream);
writeUnsigned(buffer.size(), stream);
stream.writeRawData(buffer.data(), buffer.size());
stream.writeRawData(buffer.data().constData(), buffer.size());
}
}
......@@ -169,12 +169,12 @@ void O5mWriter::writePolygons(const OsmConverter::Polygons &polygons, QDataStrea
QDataStream referencesStream(&referencesBuffer);
writeRelationMembers(*polygon.first, lastReferenceId, osmData, stringTable, referencesStream);
writeUnsigned(referencesBuffer.size(), bufferStream);
bufferStream.writeRawData(referencesBuffer.data(), referencesBuffer.size());
bufferStream.writeRawData(referencesBuffer.data().constData(), referencesBuffer.size());
writeTags(osmData, stringTable, bufferStream);
writeUnsigned(buffer.size(), stream);
stream.writeRawData(buffer.data(), buffer.size());
stream.writeRawData(buffer.data().constData(), buffer.size());
}
}
......@@ -247,7 +247,7 @@ void O5mWriter::writeStringPair(const StringPair &pair, StringTable &stringTable
data.push_back(pair.second.toUtf8());
}
data.push_back(char(0x00));
stream.writeRawData(data, data.size());
stream.writeRawData(data.constData(), data.size());
stringTable.insert(pair, stringTable.size());
} else {
auto const reference = stringTable.size() - iter.value();
......
......@@ -42,7 +42,7 @@ void AbstractDataPluginTest::initialize_data()
if ( !dataPlugin )
continue;
QTest::newRow( plugin->nameId().toLatin1() ) << dataPlugin;
QTest::newRow(plugin->nameId().toLatin1().constData()) << dataPlugin;
}
}
......
......@@ -100,7 +100,8 @@ void AbstractFloatItemTest::newInstance_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -121,7 +122,8 @@ void AbstractFloatItemTest::setSettings_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -156,7 +158,8 @@ void AbstractFloatItemTest::setPosition_data()
QTest::addColumn<const AbstractFloatItem *>( "factory" );
foreach ( const AbstractFloatItem *factory, m_factories ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......
......@@ -59,7 +59,8 @@ void RenderPluginTest::newInstance_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -85,7 +86,8 @@ void RenderPluginTest::initialize_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *plugin, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( plugin->nameId().toLatin1() ) << plugin;
QTest::newRow(plugin->nameId().toLatin1().constData())
<< plugin;
}
}
......@@ -106,7 +108,8 @@ void RenderPluginTest::setVisible_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -140,7 +143,8 @@ void RenderPluginTest::setEnabled_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -174,7 +178,8 @@ void RenderPluginTest::setSettingsVisible_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -215,7 +220,8 @@ void RenderPluginTest::setSettingsEnabled_data()
QTest::addColumn<const RenderPlugin *>( "factory" );
foreach ( const RenderPlugin *factory, m_model.pluginManager()->renderPlugins() ) {
QTest::newRow( factory->nameId().toLatin1() ) << factory;
QTest::newRow(factory->nameId().toLatin1().constData())
<< factory;
}
}
......@@ -267,7 +273,9 @@ void RenderPluginTest::setSettingsAllEqual_data()
QHash<QString, QVariant>::const_iterator const endpoint = settings.end();
for (; itpoint != endpoint; ++itpoint ) {
const QString testName = QString( "%1 %2" ).arg( plugin->nameId() ).arg( itpoint.key() );
QTest::newRow( testName.toLatin1() ) << result->settings().value( itpoint.key() ) << expected->settings().value( itpoint.key() );
QTest::newRow(testName.toLatin1().constData())
<< result->settings().value(itpoint.key())
<< expected->settings().value(itpoint.key());
}
}
}
......@@ -298,7 +306,9 @@ void RenderPluginTest::restoreDefaultSettings_data()
QHash<QString, QVariant>::const_iterator const endpoint = settings.end();
for (; itpoint != endpoint; ++itpoint ) {
const QString testName = QString( "%1 %2" ).arg( plugin->nameId() ).arg( itpoint.key() );
QTest::newRow( testName.toLatin1() ) << result->settings().value( itpoint.key() ) << expected->settings().value( itpoint.key() );
QTest::newRow(testName.toLatin1().constData())
<< result->settings().value(itpoint.key())
<< expected->settings().value(itpoint.key());
}
}
}
......
......@@ -905,7 +905,7 @@ void TestGeoDataCoordinates::testFromStringD_data()
.append(QLatin1Char(latSphere==PosSphere?'P':'N'))
.append(QLatin1Char('|')).append(QLatin1Char(locale==CLocale?'C':'L'))
.append(QLatin1Char('|')).append(string).append(QLatin1Char('|'));
QTest::newRow(rowTitle.toLatin1())
QTest::newRow(rowTitle.toLatin1().constData())
<< string
<< lon
<< lat;
......@@ -1480,7 +1480,7 @@ void TestGeoDataCoordinates::testFromLocaleString_data()
QLatin1String("|lat:") +
QString::number(sample.lat, 'f', 10);
QTest::newRow(rowTitle.toLatin1())
QTest::newRow(rowTitle.toLatin1().constData())
<< language.degree
<< language.minutes
<< language.seconds
......
......@@ -65,7 +65,7 @@ void TestGeoDataWriter::initTestCase()
// Open the files and verify
QVERIFY( file.open( QIODevice::ReadOnly ) );
QVERIFY2( parser->read( &file ), filename.toLatin1() );
QVERIFY2(parser->read(&file), filename.toLatin1().constData());
parsers.insert( filename, parserPointer );
m_testFiles << filename;
......
......@@ -92,7 +92,7 @@ void TestGeoSceneWriter::initTestCase()
QVERIFY( file.open( QIODevice::ReadOnly ) );
//Parser and verify
QVERIFY2( parser->read( &file ), filename.toLatin1() );
QVERIFY2(parser->read(&file), filename.toLatin1().constData());
parsers.insert( dataDir.filePath(filename), parserPointer );
......@@ -109,7 +109,7 @@ void TestGeoSceneWriter::saveFile_data()
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator itpoint = parsers.begin();
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator const endpoint = parsers.end();
for (; itpoint != endpoint; ++itpoint ) {
QTest::newRow( itpoint.key().toLocal8Bit() ) << itpoint.value();
QTest::newRow(itpoint.key().toLatin1().constData()) << itpoint.value();
}
}
......@@ -136,7 +136,7 @@ void TestGeoSceneWriter::saveAndLoad_data()
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator itpoint = parsers.begin();
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator const endpoint = parsers.end();
for (; itpoint != endpoint; ++itpoint ) {
QTest::newRow( itpoint.key().toLocal8Bit() ) << itpoint.value();
QTest::newRow(itpoint.key().toLatin1().constData()) << itpoint.value();
}
}
......@@ -168,7 +168,7 @@ void TestGeoSceneWriter::saveAndCompare_data()
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator itpoint = parsers.begin();
QMap<QString, QSharedPointer<GeoSceneParser> >::iterator const endpoint = parsers.end();
for (; itpoint != endpoint; ++itpoint ) {
QTest::newRow( itpoint.key().toLocal8Bit() ) << itpoint.value() << itpoint.key();
QTest::newRow(itpoint.key().toLatin1().constData()) << itpoint.value() << itpoint.key();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment