summaryrefslogtreecommitdiff
path: root/src/plugins/qmldesigner/componentsplugin/Controls/TabPositionComboBox.qml
blob: 93fd8a7caad8b5008b0c933e92d86fa896819556 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick 2.6
import HelperWidgets 2.0

ComboBox {
    useInteger: true
    backendValue: backendValues.tabPosition
    implicitWidth: 180
    model:  [ "TopEdge", "BottomEdge" ]
    scope: "Qt"

    manualMapping: true

    property bool block: false

    onValueFromBackendChanged: {
        if (!__isCompleted)
            return;

        block = true

        if (backendValues.tabPosition.value === 1)
            currentIndex = 0;
        if (backendValues.tabPosition.value === 0)
            currentIndex = 0;
        if (backendValues.tabPosition.value === 8)
            currentIndex = 1;

        block = false
    }

    onCurrentTextChanged: {
        if (!__isCompleted)
            return;

        if (block)
            return;

        if (currentText === "TopEdge")
            backendValues.tabPosition.value = 1

        if (currentText === "BottomEdge")
            backendValues.tabPosition.value = 8
    }
}