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. Wrong behavior with State's extend property
Qt 6.11 is out! See what's new in the release blog

Wrong behavior with State's extend property

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    MaxL
    wrote on last edited by
    #1

    Hi everyone,

    I was playing around with States in QML when I found out a strange behavior.
    Considering this case
    @State
    {
    name: "mainState"
    when: firstBool

    }

    State
    {
    name: "subStateOfMain"
    when: secondBool
    extend: "mainState"
    }@

    In my sense we are in :
    mainState when and only when :
    @firstBool && !secondBool@

    subStateOfMain when and only when :
    @firstBool && secondBool@

    What really happens with Qt is that it does a OR instead of a AND for the extender State ( "subStateOfMain" here ). Does anyone else has the same issue or feel that what I described should be the actual behavior ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      seawolf
      wrote on last edited by
      #2

      Hi,

      It's not going like you described. Of course states are acting as OR.

      From documentation :"When a state extends another state, it inherits all the changes of that state."

      example can be find here: http://jingfenghanmax.blogspot.fi/2010/08/extend-property-of-qml-state.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MaxL
        wrote on last edited by
        #3

        Thanks for you answer but for me it doesn't make sense to, in my case, have one state with firstBool && !secondBool while the other has firstBool && secondBool . At least we should have the possibility to choose between OR/AND .

        1 Reply Last reply
        0
        • S Offline
          S Offline
          seawolf
          wrote on last edited by
          #4

          I can't see states you described "have one state with firstBool && !secondBool while the other has firstBool && secondBool . "

          you have one state when: firstBool and when: secondBool :)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MaxL
            wrote on last edited by
            #5

            well then if you have firstBool && secondBool you don't know which state you are in. It would be the first that you have in your array.

            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