Pop quiz

Q1. Which is the method that you can use to execute JavaScript code?

  1. QJSValue::call()
  2. QJSEngine::evaluate()
  3. QJSEngine::fromScriptValue()

Q2. What is the name of the class that serves as a bridge to exchange data between JS engine and C++?

  1. QObject
  2. QJSValue
  3. QVariant

Q3. If you want to expose a C++ object to the script, which class must this object be derived from?

  1. QObject
  2. QJSValue
  3. QGraphicsItem

Q4. Which of the following kinds of functions is not available to JavaScript code?

  1. Signals
  2. Q_INVOKABLE methods
  3. Slots
  4. Global functions

Q5. When is a PyObject instance destroyed?

  1. When its value is set to Py_None
  2. When its internal reference counter drops to 0
  3. When the corresponding QtPythonValue is destroyed

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.