aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/logichelper/OrOperator.qml
blob: bb98805e3cc5858c1daf884ef10fd5eb6ee494ea (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 2.10

/*!
    \qmltype OrOperator
    \inqmlmodule QtQuick.Studio.LogicHelper
    \since QtQuick.Studio.LogicHelper 1.0
    \inherits QtObject

    \brief Evaluates two boolean input values and provides the result as output.

    The OrOperator type evaluates two boolean inputs, \l input01 and \l input02.
    The \l output is evaluated as \c true if either \l input01 or \l input02 is
    evaluated as \c true.

    Designers can use the Or Operator type in \QDS instead of writing
    JavaScript expressions.

    \section1 Example Usage

    In the following example, we use the checked state of two \l CheckBox
    types to determine the checked state of a third one:

    \code
    Rectangle {
        CheckBox {
            id: checkBox1
            text: qsTr("Check Box 1")
            checked: false
        }
        CheckBox {
            id: checkBox2
            text: qsTr("Check Box 2")
        }

        CheckBox {
            id: checkBox3
            text: qsTr("Check Box 3")
            checked: orOperator.output
        }

        OrOperator {
            id: orOperator
            input02: checkBox2.checked
            input01: checkBox1.checked
        }
    }
    \endcode

    \sa AndOperator, NotOperator
*/

QtObject {
    id: object

/*!
    The first value to evaluate.
*/
    property bool input01: false

/*!
    The second value to evaluate.
*/
    property bool input02: false

/*!
    The result of the evaluation.
*/
    property bool output: object.input01 || object.input02
}