diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-08-08 12:06:33 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-08-14 12:05:32 +0000 |
commit | 8eca7fffa34e05b198c86c4fb4184ec060b1b005 (patch) | |
tree | 60a792488254873c962f6f26df36cb20163089a1 /src/corelib/doc | |
parent | 47b879aa0b32c5072dba585dbe8438964efc108c (diff) |
Modernize snippet
It referenced QDeclarativeComponent, which has been gone for a very long
time. Also replace the foreach with a proper for loop.
Change-Id: I7f30ca10a235137dbdf34b7684e2c38610242b17
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/code/qlogging/qlogging.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/doc/snippets/code/qlogging/qlogging.cpp b/src/corelib/doc/snippets/code/qlogging/qlogging.cpp index d1c3c7b00d..a841829600 100644 --- a/src/corelib/doc/snippets/code/qlogging/qlogging.cpp +++ b/src/corelib/doc/snippets/code/qlogging/qlogging.cpp @@ -3,12 +3,12 @@ #include <QtGui> #include <QtDebug> -#include <QDeclarativeComponent> +#include <QQmlComponent> //! [1] - void statusChanged(QDeclarativeComponent::Status status) { - if (status == QDeclarativeComponent::Error) { - foreach (const QDeclarativeError &error, component->errors()) { + void statusChanged(QQmlComponent::Status status) { + if (status == QQmlComponent::Error) { + for (const QQmlError &error: std::as_const(component->errors())) { const QByteArray file = error.url().toEncoded(); QMessageLogger(file.constData(), error.line(), 0).debug() << error.description(); } |