summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/qlogging/qlogging.cpp
blob: d1c3c7b00db294886384be2a577f008e0e803bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QtGui>
#include <QtDebug>
#include <QDeclarativeComponent>

//! [1]
    void statusChanged(QDeclarativeComponent::Status status) {
        if (status == QDeclarativeComponent::Error) {
            foreach (const QDeclarativeError &error, component->errors()) {
                const QByteArray file = error.url().toEncoded();
                QMessageLogger(file.constData(), error.line(), 0).debug() << error.description();
            }
        }
    }
//! [1]

//! [2]
    const QLoggingCategory &category();
//! [2]