summaryrefslogtreecommitdiffstats
path: root/howtos/componenterror/index.rst
blob: cd869c12b3b4160ba8eb283e4ea9537178087a8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
..
    ---------------------------------------------------------------------------
    Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
    All rights reserved.
    This work, unless otherwise expressly stated, is licensed under a
    Creative Commons Attribution-ShareAlike 2.5.
    The full license document is available from
    http://creativecommons.org/licenses/by-sa/2.5/legalcode .
    ---------------------------------------------------------------------------


How to handle errors of components
==================================

You can use the :qt:`status<qml-component.html#status-prop> property of the :qt:`Component<qml-component.html>` element to check whether the component had an error while loaded.

The :qt:`status<qml-component.html#status-prop> property can be checked on the :qt:`onCompleted<qml-component.html#onCompleted-signal>` attached signal.

.. code-block:: js

    import QtQuick 1.1

     Rectangle {
        Component.onCompleted: {
            console.log("Component loaded")
        }

        onStatusChanged: {
            //check component status property
        }
     }