Compare commits

...

1 Commits

Author SHA1 Message Date
81ed1e72b1 Исправления clazy 2020-04-19 09:52:35 +03:00

View File

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