Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can't apply a state change as part of a state definition?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 788 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pokemonsrqt
    wrote on last edited by
    #1

    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
                }
            }
        }
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved