Fetch text from a site as QString
-
C++ now allows to initialize class variable at declaration spot. It's easy and nice for base types however, it can make things harder to read for complex type.
Next, unless you have complex logic associated, you should use your class initializer list and after that the constructor. This will help the compiler optimize some things.
-
@Pl45m4 Functions (
downloadFile
andreplyFinished
) are not in the header. I did not specify that but I did add MyClass scope e.g.void MyClass::downloadFile()
.@SGaist So:
MyClass(QObject *parent = nullptr) : QAbstractListModel(parent), m_manager(new QNetworkAccessManager(this)) { connect(m_manager, &QNetworkAccessManager::finished, this, &MyClass::downloadFinished); }
-
@realroot said in Fetch text from a site as QString:
@Pl45m4 Functions ( downloadFile and replyFinished) are not in the header. I did not specify that but I did add MyClass scope e.g. void MyClass::downloadFile().
Don't know what this means, but might be okay.