diff --git a/src/cmlib-example/main.cpp b/src/cmlib-example/main.cpp index 8165e5b..b297f25 100644 --- a/src/cmlib-example/main.cpp +++ b/src/cmlib-example/main.cpp @@ -7,7 +7,7 @@ // function args by ref -int qStringToInt( QString s ) +int qStringToInt( const QString &s ) { return( s.toInt() ); } @@ -20,34 +20,34 @@ int main( int argc, char** argv ) // qt-keywords QList< int > il; il << 111 << 222; - foreach( int i, il ) + Q_FOREACH( int i, il ) { qDebug() << i; } QStringList sl; // string allocations - sl << "111" << "222"; + sl << QStringLiteral("111") << QStringLiteral("222"); // loop add ref - for ( const auto& s: sl ) + for ( const auto& s: qAsConst(sl) ) { qDebug() << s; } // loop qasconst - for ( auto s: sl ) + for ( auto s: qAsConst(sl) ) { s.append( "0" ); } // function args by ref - QString s { "100" }; + QString s { QStringLiteral("100") }; auto ir = qStringToInt( s ); // old style connect QFile f; FileSignalHandler fsh; - QObject::connect( &f, SIGNAL(aboutToClose()), &fsh, SLOT(process()) ); + QObject::connect( &f, &QIODevice::aboutToClose, &fsh, &FileSignalHandler::process ); return( 0 ); } // main