Skip to content

Commit d0c93b9

Browse files
committedMar 26, 2014
Merge pull request #1244 from simonsonc/qt-no-deprecated
Fix uses of deprecated Qt methods
2 parents 9445c9a + 3e0e0ed commit d0c93b9

File tree

8 files changed

+28
-29
lines changed

8 files changed

+28
-29
lines changed
 

‎src/app/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ int main( int argc, char *argv[] )
518518
}
519519
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
520520
{
521-
mySnapshotFileName = QDir::convertSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
521+
mySnapshotFileName = QDir::toNativeSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
522522
}
523523
else if ( i + 1 < argc && ( arg == "--width" || arg == "-w" ) )
524524
{
@@ -534,35 +534,35 @@ int main( int argc, char *argv[] )
534534
}
535535
else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
536536
{
537-
myProjectFileName = QDir::convertSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
537+
myProjectFileName = QDir::toNativeSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
538538
}
539539
else if ( i + 1 < argc && ( arg == "--extent" || arg == "-e" ) )
540540
{
541541
myInitialExtent = args[++i];
542542
}
543543
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
544544
{
545-
optionpath = QDir::convertSeparators( QDir( args[++i] ).absolutePath() );
545+
optionpath = QDir::toNativeSeparators( QDir( args[++i] ).absolutePath() );
546546
}
547547
else if ( i + 1 < argc && ( arg == "--configpath" || arg == "-c" ) )
548548
{
549-
configpath = QDir::convertSeparators( QDir( args[++i] ).absolutePath() );
549+
configpath = QDir::toNativeSeparators( QDir( args[++i] ).absolutePath() );
550550
}
551551
else if ( i + 1 < argc && ( arg == "--code" || arg == "-f" ) )
552552
{
553-
pythonfile = QDir::convertSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
553+
pythonfile = QDir::toNativeSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
554554
}
555555
else if ( i + 1 < argc && ( arg == "--customizationfile" || arg == "-z" ) )
556556
{
557-
customizationfile = QDir::convertSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
557+
customizationfile = QDir::toNativeSeparators( QFileInfo( args[++i] ).absoluteFilePath() );
558558
}
559559
else if ( arg == "--defaultui" || arg == "-d" )
560560
{
561561
myRestoreDefaultWindowState = true;
562562
}
563563
else
564564
{
565-
myFileList.append( QDir::convertSeparators( QFileInfo( args[i] ).absoluteFilePath() ) );
565+
myFileList.append( QDir::toNativeSeparators( QFileInfo( args[i] ).absoluteFilePath() ) );
566566
}
567567
}
568568
}
@@ -578,7 +578,7 @@ int main( int argc, char *argv[] )
578578
// check for a .qgs
579579
for ( int i = 0; i < args.size(); i++ )
580580
{
581-
QString arg = QDir::convertSeparators( QFileInfo( args[i] ).absoluteFilePath() );
581+
QString arg = QDir::toNativeSeparators( QFileInfo( args[i] ).absoluteFilePath() );
582582
if ( arg.contains( ".qgs" ) )
583583
{
584584
myProjectFileName = arg;

‎src/app/qgsattributetypedialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ void QgsAttributeTypeDialog::loadFromCSVButtonPushed()
287287
QString l = s.readLine().trimmed();
288288

289289
QString key, val;
290-
if ( re0.indexIn( l ) >= 0 && re0.numCaptures() == 2 )
290+
if ( re0.indexIn( l ) >= 0 && re0.captureCount() == 2 )
291291
{
292292
key = re0.cap( 1 ).trimmed();
293293
val = re0.cap( 2 ).trimmed();
294294
}
295-
else if ( re1.indexIn( l ) >= 0 && re1.numCaptures() == 2 )
295+
else if ( re1.indexIn( l ) >= 0 && re1.captureCount() == 2 )
296296
{
297297
key = re1.cap( 1 ).trimmed();
298298
val = re1.cap( 2 ).trimmed();

‎src/core/qgscredentials.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#include "qgscredentials.h"
1717
#include "qgslogger.h"
1818

19-
#include <QTextIStream>
20-
#include <QTextOStream>
19+
#include <QTextStream>
2120

2221
QgsCredentials *QgsCredentials::smInstance = 0;
2322

‎src/gui/qgisgui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace QgisGui
4949

5050
if ( !lastUsedFilter.isEmpty() )
5151
{
52-
openFileDialog->selectFilter( lastUsedFilter );
52+
openFileDialog->selectNameFilter( lastUsedFilter );
5353
}
5454
openFileDialog->addCancelAll();
5555
if ( openFileDialog->exec() == QDialog::Accepted )
@@ -146,7 +146,7 @@ namespace QgisGui
146146

147147
if ( !lastUsedFilter.isEmpty() ) // set the filter to the last one used
148148
{
149-
fileDialog->selectFilter( lastUsedFilter );
149+
fileDialog->selectNameFilter( lastUsedFilter );
150150
}
151151

152152
//prompt the user for a fileName

‎src/gui/qgsdetaileditemdelegate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ void QgsDetailedItemDelegate::paint( QPainter * thepPainter,
4949
{
5050
// After painting we need to restore the painter to its original state
5151
thepPainter->save();
52-
if ( qVariantCanConvert<QgsDetailedItemData>( theIndex.data( Qt::UserRole ) ) )
52+
if ( theIndex.data( Qt::UserRole ).canConvert<QgsDetailedItemData>() )
5353
{
5454
QgsDetailedItemData myData =
55-
qVariantValue<QgsDetailedItemData>( theIndex.data( Qt::UserRole ) );
55+
theIndex.data( Qt::UserRole ).value<QgsDetailedItemData>();
5656
if ( myData.isRenderedAsWidget() )
5757
{
5858
paintAsWidget( thepPainter, theOption, myData );
@@ -71,10 +71,10 @@ QSize QgsDetailedItemDelegate::sizeHint(
7171
const QStyleOptionViewItem & theOption,
7272
const QModelIndex & theIndex ) const
7373
{
74-
if ( qVariantCanConvert<QgsDetailedItemData>( theIndex.data( Qt::UserRole ) ) )
74+
if ( theIndex.data( Qt::UserRole ).canConvert<QgsDetailedItemData>() )
7575
{
7676
QgsDetailedItemData myData =
77-
qVariantValue<QgsDetailedItemData>( theIndex.data( Qt::UserRole ) );
77+
theIndex.data( Qt::UserRole ).value<QgsDetailedItemData>();
7878
if ( myData.isRenderedAsWidget() )
7979
{
8080
return QSize( 378, mpWidget->height() );

‎src/gui/qgsencodingfiledialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ QgsEncodingFileDialog::QgsEncodingFileDialog( QWidget * parent,
6161
// need to force selection of the first filter since that corresponds to
6262
// the file name we're looking for; even if we're not here from
6363
// findFiles_(), it won't hurt to force selection of the first file filter
64-
selectFilter( filters().at( 0 ) );
64+
selectNameFilter( nameFilters().at( 0 ) );
6565

6666
// Connect our slot to get a signal when the user is done with the file dialog
6767
connect( this, SIGNAL( accepted() ), this, SLOT( saveUsedEncoding() ) );

‎tests/bench/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ int main( int argc, char *argv[] )
209209
break;
210210

211211
case 's':
212-
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
212+
mySnapshotFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
213213
break;
214214

215215
case 'l':
216-
myLogFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
216+
myLogFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
217217
break;
218218

219219
case 'w':
@@ -225,7 +225,7 @@ int main( int argc, char *argv[] )
225225
break;
226226

227227
case 'p':
228-
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
228+
myProjectFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( optarg ) ).absoluteFilePath() );
229229
break;
230230

231231
case 'e':
@@ -278,7 +278,7 @@ int main( int argc, char *argv[] )
278278
int idx = optind;
279279
QgsDebugMsg( QString( "%1: %2" ).arg( idx ).arg( argv[idx] ) );
280280
#endif
281-
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[optind++] ) ).absoluteFilePath() ) );
281+
myFileList.append( QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[optind++] ) ).absoluteFilePath() ) );
282282
}
283283
}
284284
#else
@@ -297,11 +297,11 @@ int main( int argc, char *argv[] )
297297
}
298298
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
299299
{
300-
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
300+
mySnapshotFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
301301
}
302302
else if ( i + 1 < argc && ( arg == "--log" || arg == "-l" ) )
303303
{
304-
myLogFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
304+
myLogFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
305305
}
306306
else if ( i + 1 < argc && ( arg == "--width" || arg == "-w" ) )
307307
{
@@ -313,7 +313,7 @@ int main( int argc, char *argv[] )
313313
}
314314
else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
315315
{
316-
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
316+
myProjectFileName = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
317317
}
318318
else if ( i + 1 < argc && ( arg == "--extent" || arg == "-e" ) )
319319
{
@@ -346,7 +346,7 @@ int main( int argc, char *argv[] )
346346
}
347347
else
348348
{
349-
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
349+
myFileList.append( QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
350350
}
351351
}
352352
#endif //WIN32
@@ -457,7 +457,7 @@ int main( int argc, char *argv[] )
457457
// check for a .qgs
458458
for ( int i = 0; i < argc; i++ )
459459
{
460-
QString arg = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() );
460+
QString arg = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() );
461461
if ( arg.contains( ".qgs" ) )
462462
{
463463
myProjectFileName = arg;

‎tests/src/providers/testqgswcspublicservers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ int main( int argc, char *argv[] )
982982
return 1;
983983
}
984984

985-
QString myCacheDirPath = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[optind] ) ).absoluteFilePath() ) ;
985+
QString myCacheDirPath = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[optind] ) ).absoluteFilePath() ) ;
986986

987987
QgsDebugMsg( "myCacheDirPath = " + myCacheDirPath );
988988

0 commit comments

Comments
 (0)
Please sign in to comment.