aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qmldesigner/effectComposerQmlSources/EffectCompositionNodeUniform.qml
blob: 8dc3b75c9b5d070539c3cb706184371f15f1994d (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick
import QtQuick.Dialogs
import QtQuick.Layouts
import HelperWidgets as HelperWidgets
import StudioControls as StudioControls
import StudioTheme as StudioTheme
import EffectComposerBackend

Item {
    id: root

    height: layout.implicitHeight

    visible: !uniformUseCustomValue

    Component.onCompleted: {
        if (uniformType === "int")
            valueLoader.source = "ValueInt.qml"
        else if (uniformType === "vec2")
            valueLoader.source = "ValueVec2.qml"
        else if (uniformType === "vec3")
            valueLoader.source = "ValueVec3.qml"
        else if (uniformType === "vec4")
            valueLoader.source = "ValueVec4.qml"
        else if (uniformType === "bool")
            valueLoader.source = "ValueBool.qml"
        else if (uniformType === "color")
            valueLoader.source = "ValueColor.qml"
        else if (uniformType === "sampler2D")
            valueLoader.source = "ValueImage.qml"
        else if (uniformType === "define")
            valueLoader.source = "ValueDefine.qml"
        else
            valueLoader.source = "ValueFloat.qml"
    }

    RowLayout {
        id: layout

        spacing: 20
        anchors.fill: parent

        Text {
            text: uniformName
            color: StudioTheme.Values.themeTextColor
            font.pixelSize: StudioTheme.Values.baseFontSize
            horizontalAlignment: Text.AlignRight
            Layout.maximumWidth: 140
            Layout.minimumWidth: 140
            Layout.preferredWidth: 140
            elide: Text.ElideRight

            HelperWidgets.ToolTipArea {
                anchors.fill: parent
                tooltip: uniformDescription
            }
        }

        Loader {
            id: valueLoader
            Layout.fillWidth: true
        }
    }
}