Все автозамены

This commit is contained in:
Andrei Astafev 2020-04-19 09:47:42 +03:00
parent b0a7d38980
commit 281ec272d8
2 changed files with 19 additions and 11 deletions

11
src/cmlib-example/fsh.hpp Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#include <QObject>
class FileSignalHandler : public QObject {
Q_OBJECT
public:
Q_SLOT void process() {};
};

View File

@ -7,14 +7,9 @@
// function args by ref
int sum(QStringList sl)
int qStringToInt(QString s)
{
int s = 0;
for(auto str: sl)
{
s += str.toInt();
}
return s;
return s.toInt();
}
@ -24,15 +19,16 @@ int main( int argc, char** argv )
// qt-keywords
QList<int> il;
il << 111 << 222 << 333;
il << 111 << 222;
foreach(int i, il)
{
qDebug() << i;
}
// loop add ref
QStringList sl;
sl << "111" << "222" << "333";
// string allocations
sl << "111" << "222";
// loop add ref
for (const auto &s: sl)
{
qDebug() << s;
@ -45,7 +41,8 @@ int main( int argc, char** argv )
}
// function args by ref
auto ir = sum(sl);
QString s { "100" };
auto ir = qStringToInt(s);
// old style connect
QFile f;