diff --git a/src/cmlib-example/fsh.hpp b/src/cmlib-example/fsh.hpp new file mode 100644 index 0000000..9db3a41 --- /dev/null +++ b/src/cmlib-example/fsh.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include + +class FileSignalHandler : public QObject { + Q_OBJECT +public: + Q_SLOT void process() {}; +}; + + diff --git a/src/cmlib-example/main.cpp b/src/cmlib-example/main.cpp index 2a8458d..3175798 100644 --- a/src/cmlib-example/main.cpp +++ b/src/cmlib-example/main.cpp @@ -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 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;