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. Strange behaviour in qml in switch case statement
Forum Updated to NodeBB v4.3 + New Features

Strange behaviour in qml in switch case statement

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 21.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
    MichK
    wrote on 20 Sept 2011, 13:52 last edited by
    #1

    I found strange behaviour in switch case statement in my qml code.
    @
    onItemClicked: {
    console.log("clicked command " + command)
    switch(command) {
    //...
    case ListsListMenu.EAboutCommand:
    console.log("about command")
    listsListViewRoot.showAboutDialog()
    break;
    case ListsListMenu.EHelpCommand:
    break;
    case ListsListMenu.EExitCommand:
    break;
    default:
    break
    }
    }
    @
    I found that only first line after case statement is executed. To execute all lines for given case value I have to enclose them in braces.
    @
    case ListsListMenu.EAboutCommand:
    {
    console.log("about command")
    listsListViewRoot.showAboutDialog()
    }
    break;
    @

    This is strange, because I would expect that everything is executed until break; is reached.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on 20 Sept 2011, 23:19 last edited by
      #2

      Hi,

      It sounds like you have run into https://bugreports.qt.nokia.com/browse/QTBUG-17012 . This issue should be fixed for QtQuick 2.0.

      Regards,
      Michael

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MichK
        wrote on 21 Sept 2011, 05:52 last edited by
        #3

        Hi,

        Thanks for the info.

        1 Reply Last reply
        0

        3/3

        21 Sept 2011, 05:52

        • Login

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