Can't apply a state change as part of a state definition?



  • When I build an application with the following code on my local machine, the application works fine. When I let my Jenkins server build from the same source code I an error message and unexpected behavior. The environments presumably have some difference in versions of compile tools.

    The error message I get is

    QML StateGroup: Can't apply a state change as part of a state definition
    

    The unexpected behavior that I get is that lowerBoundaryRect is not correctly anchored.

    What can I change in my code to make it work when built on either environment? Alternatively, what tools should I verify have the exact same version to make the environments behave the same?

    import QtQuick 2.6
    import QtQuick.Layouts 1.1
    import Qip.Properties 1.0 as QipProperties
    import Qip.Components 1.0 as QipComponents
    import Qip.Utilities 1.0
    
    Item {
        id: root
        property string unit
        property real unitPrefixFactor
    
        Rectangle {
            id: lowerBoundaryLine
            x: ui.selectionModel.lowerBoundaryPixel
            width: 1
            height: parent.height
            color: QipProperties.Colors.text
        }
    
        Rectangle {
            id: lowerBoundaryRect
            color: QipProperties.Colors.transparentSelectionBackground
            anchors.top: parent.top
            anchors.right: lowerBoundaryLine.left
            implicitHeight: lowerBoundaryRectLayout.implicitHeight + QipProperties.Margins.small * 2
            implicitWidth: lowerBoundaryRectLayout.implicitWidth + QipProperties.Margins.medium * 2
    
            states: [
                State {
                    name: "rightOfScreen"
                    when: upperBoundaryRect.width > root.width - (lowerBoundaryLine.x + lowerBoundaryLine.width)
                    AnchorChanges {
                        target: lowerBoundaryRect
                        anchors.right: upperBoundaryRect.left
                        anchors.left: undefined
                    }
                },
                State {
                    name: "leftOfScreen"
                    when: lowerBoundaryLine.x < lowerBoundaryRect.width
                    AnchorChanges {
                        target: lowerBoundaryRect
                        anchors.right: undefined
                        anchors.left: root.left
                    }
                }
             ]
    
            ColumnLayout {
                id: lowerBoundaryRectLayout
                spacing: QipProperties.Margins.small
                anchors.topMargin: QipProperties.Margins.small
                anchors.bottomMargin: QipProperties.Margins.small
                anchors.leftMargin: QipProperties.Margins.medium
                anchors.rightMargin: QipProperties.Margins.medium
                anchors.fill: parent
    
                QipComponents.HeaderText {
                    id: lowerBoundaryData
                    text: Converter.formatDuration(ui.selectionModel.lowerBoundaryUs, Converter.MicroSeconds, Converter.MicroSeconds)
                }
    
                QipComponents.HeaderText {
                    id: deltaDataAtLowerBoundary
                    text: "Δ " + Converter.formatDuration(ui.selectionModel.deltaUs, Converter.MicroSeconds, Converter.MicroSeconds)
                    visible: !ui.selectionModel.startsAtLowerBoundaryUs
                }
            }
        }
    
        Rectangle {
            id: upperBoundaryLine
            x: ui.selectionModel.upperBoundaryPixel - 1
            width: 1
            height: parent.height
            color: QipProperties.Colors.text
        }
    
        Rectangle {
            id: upperBoundaryRect
            color: QipProperties.Colors.transparentSelectionBackground
            anchors.top: parent.top
            anchors.left: upperBoundaryLine.right
            implicitHeight: upperBoundaryRectLayout.implicitHeight + QipProperties.Margins.small * 2
            implicitWidth: upperBoundaryRectLayout.implicitWidth + QipProperties.Margins.medium * 2
    
            states: [
                State {
                    name: "rightOfScreen"
                    when: upperBoundaryRect.width > root.width - (upperBoundaryLine.x + upperBoundaryLine.width)
                    AnchorChanges {
                        target: upperBoundaryRect
                        anchors.right: root.right
                        anchors.left: undefined
                    }
                },
                State {
                    name: "leftOfScreen"
                    when: upperBoundaryLine.x < lowerBoundaryRect.width
                    AnchorChanges {
                        target: upperBoundaryRect
                        anchors.right: undefined
                        anchors.left: lowerBoundaryRect.right
                    }
                }
             ]
    
            ColumnLayout {
                id: upperBoundaryRectLayout
                spacing: QipProperties.Margins.small
                anchors.topMargin: QipProperties.Margins.small
                anchors.bottomMargin: QipProperties.Margins.small
                anchors.leftMargin: QipProperties.Margins.medium
                anchors.rightMargin: QipProperties.Margins.medium
                anchors.fill: parent
    
                QipComponents.HeaderText {
                    id: upperBoundaryData
                    text: Converter.formatDuration(ui.selectionModel.upperBoundaryUs, Converter.MicroSeconds, Converter.MicroSeconds)
                }
    
                QipComponents.HeaderText {
                    id: deltaDataAtUpperBoundary
                    text: "Δ " + Converter.formatDuration(ui.selectionModel.deltaUs, Converter.MicroSeconds, Converter.MicroSeconds)
                    visible: ui.selectionModel.startsAtLowerBoundaryUs
                }
            }
        }
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.