Исправления clazy

This commit is contained in:
Andrei Astafev 2020-04-19 09:52:35 +03:00
parent 68315ce08d
commit 81ed1e72b1

View File

@ -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