Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Are pre-processor directives supported in .qml files?
Forum Updated to NodeBB v4.3 + New Features

[Solved] Are pre-processor directives supported in .qml files?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.2k 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
    molto_bravo
    wrote on last edited by
    #1

    Hi,

    As the title suggests, I am interested in knowing if there is any support for pre-processor directives in qml files. I am mainly interested in learning if there is a way to use the #ifdefined (or something similar) around qml and embedded JavaScript code. If there is a way, can you please let me know.

    Thanks,

    1 Reply Last reply
    0
    • M Offline
      M Offline
      molto_bravo
      wrote on last edited by
      #2

      Forgot to mention that I am using Qt Creator 2.8.1 (based on Qt 5.1.1) for running my qml project under Windows 7.

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi,

        QML and JavaScript are not compiled. Instead, they are interpreted (processed) during run-time, so there's no such thing as preprocessor directives. If you want decision-making, just use normal if/else.

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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          molto_bravo
          wrote on last edited by
          #4

          Thanks JKSH for you answering my question. What you said makes perfect sense.

          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