Warning - Undefined variable Qt

Last edited on

Symptom

The Python Code Analyzer does not know about Squish’s Qt Convenience API functions (Qt.LeftButton, etc.), which results in the Undefined variable Qt warning.

Solution

Configure the Code Analysis to ignore Qt.* as an undefined variable

  1. Select Edit > Preferences (Mac: Squish IDE > Preferences)

  2. Expand PyDev > Editor and select Code Analysis

  3. Click Undefined

  4. Append ,Qt to the existing content in the Consider the following names as globals box

  5. Click OK

When you close and re-open the script you were working with, or fresh the code analysis by making changes to your script, the Undefined variable Qt warning no longer appears.

While disabling warnings (especially globally) is not an advised approach, in this case, the Qt warning can be ignored.