Qt Creator Manual

Checking Code Syntax

As you write code Qt Creator checks code syntax. When Qt Creator spots a syntax error in your code it underlines it and shows error details when you move the mouse pointer over the error.

  • Syntax errors are underlined in red.

    In the following figure, a semicolon is missing at the end of the line.

  • Semantic errors and warnings are underlined in olive.

    In the following figure, the type is unknown.

Checking JavaScript Syntax

You can run static checks on JavaScript to find common problems, such as:

  • Duplicate or conflicting variable, function, and formal parameter declarations
  • Variables and functions that are used before they are declared
  • Possibly unsafe uses of the == or != operators
  • Comma expressions, except in for statements
  • Expression statements, except function or method calls, assignments, or delete
  • Assignments within conditions (such as, if (a = b))
  • Case blocks within a switch that do not end with a return, break, continue, or throw and that are not empty
  • Nested block statements
  • with statements
  • void expressions

To run the checks, select Tools > QML/JS > Run Checks or press Ctrl+Shift+C. The results are shown in the QML Analysis filter of the Issues output pane.