From 21b2c1d04acf2ed71734c59bb1047fabd41291fb Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 24 Aug 2018 13:28:54 +0200 Subject: [PATCH] Doc: Update information about checking QML and JavaScript code The error messages and codes are displayed when you write code. The JSON information is unrelated and was moved further down the topic. Added a screenshot of checking QML code. Used defines to mark C++ specific parts. Change-Id: I08a122727200208474036adec56afd6235b56d6a Reviewed-by: Marco Benelli Reviewed-by: Thomas Hartmann --- doc/images/qml-syntax-check.png | Bin 0 -> 6140 bytes doc/src/editors/creator-code-syntax.qdoc | 66 ++++++++++++--------- doc/src/howto/creator-only/creator-ui.qdoc | 8 +-- 3 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 doc/images/qml-syntax-check.png diff --git a/doc/images/qml-syntax-check.png b/doc/images/qml-syntax-check.png new file mode 100644 index 0000000000000000000000000000000000000000..bccfe3e71872f0ef53fc7879dd907c9a8df0ef90 GIT binary patch literal 6140 zcmeAS@N?(olHy`uVBq!ia0y~yVA5q^V7S7;#K6FCzq92o1B3WsPZ!6Kid%2z#%4=L z&T4pm-=}{0TOGw6>KCS^+_LR7-N|w7L{|KhWt>ijJam|kakH(T@OE}46L;U*X$i;0 znUB4l!1F`PQ`-6a+VcFGo&Pj%7Qgx&a@BIF*3K_4msc*ByXw-!m`SfM{+_q}-0$}H z`+mQ>9h2DgF!D1pFvuNpW?-n`z{B)9@{nanyXic&YISi@)z60;47K?8##b1< zGXC-4>hG3M!q@-4zLyoaDyj6l%?k#_{?Fn^pB(Q$>U{L-Bz*zUWvX6BK_9|PWejGS=E*~w}4)_WS8|`={+$)y}gq;cZmS*6kmnWIog# z z^bS}2y3jX=eU7vL4as@CTW{j^lJW@~RJxS(3fb;|DbtkGx>A)i=W3EvyXsf>8_tgH zt~#s?6&b&5p4`kR{JnCMYn9Up=ZNEG$D6~?y_xvsTJ~+#`19R+*MEN&dsAoMs`J%( zpVz8Q`BwLFYe?Xa%A<#wKY71b{CkhlW=YE4bIfu=$2%782}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tW$IV?&JrG3=9XHK`sN089=I2mKvet+nzE1*ic5*gu+mTe z#0#<%6nfBMWLP6s!I*#MuLm=KKL(p%BlpNI3=|BYAc6z~hzBwe!h@IqYh(1-ro1Q* z&y$&Rt6Ou9>=tmewu$n;{B@U;v-DMJxQBSUbt*{9;nSy&u1nXtHp}`3D8LQm_#-z8 zR$4MJNVKX<$;aFuZ?(fq{X+)78&qol`;+ E07-a7V*mgE literal 0 HcmV?d00001 diff --git a/doc/src/editors/creator-code-syntax.qdoc b/doc/src/editors/creator-code-syntax.qdoc index 4373891018c..821fddfba8a 100644 --- a/doc/src/editors/creator-code-syntax.qdoc +++ b/doc/src/editors/creator-code-syntax.qdoc @@ -37,6 +37,7 @@ JavaScript object notation (JSON) entity, \QC underlines errors in JSON data structure. + \if defined(qtcreator) \list \li Syntax errors are underlined in red. @@ -64,6 +65,15 @@ \image qtcreator-semanticerror-clang.png + \else + In addition to underlining, errors and warnings are marked with icons and + annotated. + \endif + When writing QML or JavaScript code, the annotations may contain error codes + listed in \l{JavaScript and QML Error Codes}. + + \image qml-syntax-check.png + To specify the position where the annotations are displayed, select \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Display > \uicontrol {Line annotations}, and then select @@ -75,37 +85,15 @@ If you hide the annotations by deselecting the check box, you can move the mouse pointer over an icon to view them. - \section1 Checking JSON Data Structure + \section1 JavaScript and QML Error Codes - You can run static checks on the QML and JavaScript code in - your project to find common problems. + You can run static checks on the QML and JavaScript code in your project to + find common problems. To run the checks, select \uicontrol Tools > + \uicontrol {QML/JS} > \uicontrol {Run Checks} or press \key {Ctrl+Shift+C}. + The results are shown in the \uicontrol QML and \uicontrol {QML Analysis} + filters of the \uicontrol Issues output pane. - \QC validates instances of JSON entities against - \l{http://tools.ietf.org/html/draft-zyp-json-schema-03} - {A JSON Media Type for Describing the Structure and Meaning of JSON Documents}. - However, \QC does not understand the entire specification. - - A JSON schema defines the structure of JSON data. It determines what JSON - data is required for an application and how to interact with it. - - The specification does not define how to map JSON instances with JSON - schemas. \QC looks for a JSON schema file with a name that matches the - name of the JSON instance file in the user configuration folder. For - example, \c {~/config/QtProject/qtcreator/json} on Linux and \macos and - \c {C:\Users\username\AppData\Roaming\QtCreator\qtcreator\json} on - Windows. To check JSON data structure, copy the JSON schema file to the - above folder. - - \section2 Checking JavaScript and QML Syntax - - To run the checks, select \uicontrol Tools > \uicontrol {QML/JS} > - \uicontrol {Run Checks} or press \key {Ctrl+Shift+C}. The results are shown - in the \uicontrol {QML Analysis} filter of the \uicontrol Issues output - pane. - - \section2 List of JavaScript and QML Checks - - Many of the JavaScript checks are similar to the ones in Douglas Crockford's + Many of the error messages are similar to the ones in Douglas Crockford's \l{http://www.jslint.com}{JSLint} tool. For more information about JSLint errors, see \l{http://linterrors.com/js}{JSLint Error Explanations}. @@ -666,6 +654,24 @@ \endtable + \section1 Checking JSON Data Structure + + \QC validates instances of JSON entities against + \l{http://tools.ietf.org/html/draft-zyp-json-schema-03} + {A JSON Media Type for Describing the Structure and Meaning of JSON Documents}. + However, \QC does not understand the entire specification. + + A JSON schema defines the structure of JSON data. It determines what JSON + data is required for an application and how to interact with it. + + The specification does not define how to map JSON instances with JSON + schemas. \QC looks for a JSON schema file with a name that matches the + name of the JSON instance file in the user configuration folder. For + example, \c {~/config/QtProject/qtcreator/json} on Linux and \macos and + \c {C:\Users\username\AppData\Roaming\QtCreator\qtcreator\json} on + Windows. To check JSON data structure, copy the JSON schema file to the + above folder. + \section1 Resetting the Code Model If you change the build and run kit when you have QML files open in the code @@ -680,9 +686,11 @@ To reset the code model, select \uicontrol Tools > \uicontrol {QML/JS} > \uicontrol {Reset Code Model}. + \if defined(qtcreator) If this does not help, try changing the QML emulation layer to the one that was built with the same Qt version as the one selected in the build and run kit. For more information, see \l{Running QML Modules in Design Mode}. + \endif \section1 Inspecting QML and JavaScript diff --git a/doc/src/howto/creator-only/creator-ui.qdoc b/doc/src/howto/creator-only/creator-ui.qdoc index dbc9d4038a2..081dca8aa2c 100644 --- a/doc/src/howto/creator-only/creator-ui.qdoc +++ b/doc/src/howto/creator-only/creator-ui.qdoc @@ -198,11 +198,9 @@ \li \uicontrol Python - Runtime errors and exceptions of Python scripts. - \li \uicontrol QML - Errors in QML syntax. - - \li \uicontrol {QML Analysis} - Results of the JavaScript - \l{Checking JavaScript and QML Syntax} - {code syntax and validation checks} + \li \uicontrol QML and \uicontrol {QML Analysis} - + \l{JavaScript and QML Error Codes} + {QML and JavaScript syntax errors}. \endlist