summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-08-08 12:06:33 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2023-08-14 12:05:32 +0000
commit8eca7fffa34e05b198c86c4fb4184ec060b1b005 (patch)
tree60a792488254873c962f6f26df36cb20163089a1 /src/corelib/doc
parent47b879aa0b32c5072dba585dbe8438964efc108c (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.cpp8
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();
}