How to write conditional import statements in QML?

Aquarius_Girl

Like we have preprocessor directives in C++ for conditional includes.

Similarly, how to do conditional importing in QML?

if x  
    import ABC 1.0  
else  
    import PQR 2.0  
Yoann Quenach de Quivillic

Depending on what you want to achieve, a possible workaround is to use a Loader. But it does not import a module, it just allows to choose dynamically which QML component you'll use.

Loader
{
    source: condition?"RedRectangle.qml":"BlueRectangle.qml"
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to write conditional statements in ng-class?

From Dev

How can I write a conditional without any conditional statements or operators?

From Dev

How can I write a conditional without any conditional statements or operators?

From Dev

How to write parser which handles import statements?

From Dev

how to write a coin counter function with only conditional statements in JavaScript?

From Java

ES6: Conditional & Dynamic Import Statements

From Java

How to shorten my conditional statements

From Dev

Pythonic way to write long import statements

From Dev

How to write conditional css?

From Dev

How are import statements useful at runtime

From Dev

How to write nested if statements in haskell?

From Dev

How to write a query with "or" statements in iBATIS?

From Dev

How to write prepared statements for this query?

From Dev

Conditional import - how to discard records?

From Java

How simplify repeat conditional Statements on different seclcet?

From Dev

How to have conditional statements in "linked" method calls?

From Dev

How to add different conditional statements in SQL query

From Dev

How can I DRY this series of conditional statements?

From Dev

How do I simplify a conditional with multiple or statements?

From Java

How to write a conditional in a search query?

From Dev

How to write a conditional query with Elasticsearch?

From Dev

how to write conditional .htaccess file

From Dev

How to write a conditional sql query?

From Dev

How to import javascript file to qml worker script

From Dev

How to write "javadoc" statements in Thrift IDL?

From Dev

How to write multiple statements in one if block in clojure?

From Dev

How to write switch statements based on 3 variables?

From Dev

How to write unclosed HTML statements with JavaScript

From Dev

How to write multiple statements in one if block in clojure?

Related Related

  1. 1

    how to write conditional statements in ng-class?

  2. 2

    How can I write a conditional without any conditional statements or operators?

  3. 3

    How can I write a conditional without any conditional statements or operators?

  4. 4

    How to write parser which handles import statements?

  5. 5

    how to write a coin counter function with only conditional statements in JavaScript?

  6. 6

    ES6: Conditional & Dynamic Import Statements

  7. 7

    How to shorten my conditional statements

  8. 8

    Pythonic way to write long import statements

  9. 9

    How to write conditional css?

  10. 10

    How are import statements useful at runtime

  11. 11

    How to write nested if statements in haskell?

  12. 12

    How to write a query with "or" statements in iBATIS?

  13. 13

    How to write prepared statements for this query?

  14. 14

    Conditional import - how to discard records?

  15. 15

    How simplify repeat conditional Statements on different seclcet?

  16. 16

    How to have conditional statements in "linked" method calls?

  17. 17

    How to add different conditional statements in SQL query

  18. 18

    How can I DRY this series of conditional statements?

  19. 19

    How do I simplify a conditional with multiple or statements?

  20. 20

    How to write a conditional in a search query?

  21. 21

    How to write a conditional query with Elasticsearch?

  22. 22

    how to write conditional .htaccess file

  23. 23

    How to write a conditional sql query?

  24. 24

    How to import javascript file to qml worker script

  25. 25

    How to write "javadoc" statements in Thrift IDL?

  26. 26

    How to write multiple statements in one if block in clojure?

  27. 27

    How to write switch statements based on 3 variables?

  28. 28

    How to write unclosed HTML statements with JavaScript

  29. 29

    How to write multiple statements in one if block in clojure?

HotTag

Archive