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. Is there a way to use Switch Statements in QML UI files?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to use Switch Statements in QML UI files?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 1.2k Views 2 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.
  • G Offline
    G Offline
    GoldRatio
    wrote on 26 Jun 2018, 05:45 last edited by
    #1

    I know that you can create a separate QML file and create the javascript statements and then import the QML Item into the QML UI file, but I want to know if there is a way to directly implement switch statements and other javascript functions into QML UI files.

    Thanks!

    J 1 Reply Last reply 26 Jun 2018, 08:15
    0
    • G GoldRatio
      26 Jun 2018, 05:45

      I know that you can create a separate QML file and create the javascript statements and then import the QML Item into the QML UI file, but I want to know if there is a way to directly implement switch statements and other javascript functions into QML UI files.

      Thanks!

      J Offline
      J Offline
      JKSH
      Moderators
      wrote on 26 Jun 2018, 08:15 last edited by
      #2

      Hi @GoldRatio, *.ui.qml files are meant to only contain elements that are editable via the Qt Quick Designer. Switch statements are not declarative code, so they are not supported in *.ui.qml files: http://doc.qt.io/qtcreator/creator-quick-ui-forms.html

      If you want, you can put everything (graphical items AND switch statements) inside a single *.qml file. This is actually how QML originally worked. *ui.qml files are a recent addition, created to support the Qt Quick Designer.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      2

      1/2

      26 Jun 2018, 05:45

      • Login

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