![]() ![]() The debugger adds some special properties to the script engine: _FILE_ holds the name of the script in which the current evaluation occurs, and _LINE_ holds the current line number. This will make the code safe for debugging. by rendering to an image, like the Context2D and Tetrix Qt Script examples do. If you need to debug painting-related script code, that code should be evaluated outside of the C++ paintEvent(), e.g. Nested evaluation requires some thought when deciding how the debugger is presented to the user for example, whether a modal dialog is suitable, or whether some parts of the main application user interface should be disabled while the debugger is running.ĭebugging inside of a paintEvent() is currently not supported. Note that it will not stop when encountering debugger statements. The debugger will enter interactive mode for the new script if an exception is thrown or a breakpoint is reached. This kind of nested evaluation is permitted. For example, a C++ timer might trigger that causes a script function to be called, or the user might click on a button in the main application user interface whose clicked() signal is connected to a script function. This means that it is possible that more scripts are evaluated, even though the debugger has suspended evaluation of the current script evaluation. When the Qt Script debugger is running, the C++ application itself is not "frozen". In the following snippet, the call to QScriptEngine::evaluate() causes the debugger to be triggered, and the function call does not return until the user has finished interacting with the debugger. When evaluation is suspended, the debugger will also suspend the event loop of the script. When calling QScriptEngine::evaluate() it is useful to pass a descriptive script name (file name) as second argument, as this is the name that will be displayed by the debugger in the ScriptsWidget if a name is not passed, the script will be labelled "anonymous". The state() function returns the debugger's current state. The evaluationResumed() signal is emitted when script evaluation is resumed, i.e, when execution control is given back to the script engine. The evaluationSuspended() signal is emitted when the debugger has suspended script evaluation and entered interactive mode, i.e., the mode in which it accepts input from the user. The createStandardToolBar() function creates a standard toolbar, and the createStandardMenu() function creates a standard menu these functions can be useful if you are creating a custom debugger configuration. Similarly, the action() function provides access to the various debugger actions. This makes it possible to arrange the widgets in a custom manner. ![]() The actions available are identified by the DebuggerAction enum, and the widgets are identified by the DebuggerWidget enum.Īccess to the individual debugger widgets is provided by the widget() function. It also provides a set of widgets (components) that display the information available from the debugger and that trigger the actions on request. ![]() The debugger defines a set of actions that are available, such as stopping execution or printing the contents of a variable. This can be changed by calling the setAutoShowStandardWindow() function. Debugger - >action( QScriptEngineDebugger ::InterruptAction) - >trigger() īy default, the standard debugger window is shown when evaluation is suspended. ![]()
0 Comments
Leave a Reply. |