Warning, /sdk/doxyqml/tests/functional/basic/input/FunctionArgs.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Header bla
0003  */
0004 import QtQuick 1.1
0005 
0006 /**
0007  * A very simple item
0008  */
0009 Item {
0010     /**
0011      * The 'foo' property
0012      */
0013     property int foo
0014 
0015     signal clicked(int x, int y)
0016 
0017     signal activated
0018 
0019     /**
0020      * Do something with arg1 and arg2
0021      * @param type:string arg1 first argument
0022      * @param type:int arg2 second argument
0023      */
0024     function doSomething(arg1, arg2) {
0025         console.log("arg1=" + arg1);
0026     }
0027 
0028     /**
0029      * A badly documented function. Missing one argument and documenting a
0030      * non-existing document
0031      * @param type:string foo first argument
0032      * @param type:int baz this argument does not exist
0033      */
0034     function badlyDocumented(foo, bar) {
0035     }
0036 
0037     property string escaped: "a string \n \" \t with escaped chars"
0038     property string block: "a string with some block {({ ] } chars"
0039 
0040     /**
0041      * Compute the arg^2
0042      * @return type:int the result
0043      */
0044     function square(arg) {
0045         return arg * arg;
0046     }
0047 
0048     /**
0049      * Function with int default parameter
0050      * @param type:int arg A parameter with a defaultvalue
0051      * @return type:int the result
0052      */
0053     function intDefaultParameter(arg = 0) {
0054         return arg;
0055     }
0056 
0057     /**
0058      * Function with string default parameter
0059      * @param type:string arg A parameter with a default value
0060      * @return type:string the result
0061      */
0062     function stringDefaultParameter(arg = "hello") {
0063         return arg;
0064     }
0065 
0066     /**
0067      * Function with property as default parameter
0068      * @param type:int arg A parameter with a default value
0069      * @return type:int the result
0070      */
0071     function propDefaultParameter(arg = foo) {
0072         return arg;
0073     }
0074 
0075     /**
0076      * Function that takes a pointer type parameter
0077      * @param type:QObject* arg A pointer to an object derived from a QObject type
0078      */
0079     function handleAnObject(arg) {
0080       arg.aMethod()
0081     }
0082 
0083     /// One-line comment
0084     function refresh() {
0085     }
0086 
0087     /// Function that takes an empty object as default value for a parameter
0088     function objectDefaultParam(arg = {}) {
0089         return arg
0090     }
0091 
0092     /// Function that has arguments and a spread argument
0093     function argumentsWithSpread(arg1, arg2 = {}, ...args) {
0094       return arg1;
0095     }
0096 
0097     /// Function that has only spread arguments
0098     function onlySpread(...args) {
0099     }
0100 
0101     /// Function that takes an empty array as default value for a parameter
0102     function arrayDefaultParam(arg = []) {
0103         return arg
0104     }
0105 
0106     /// Default values can now be expressions
0107     function complicatedDefaultValue(area = 10.0 * 20.0) {}
0108 
0109     /// Function with arguments
0110     function typedFunction(a: int, arg: var, item: Item) {}
0111 
0112     /// Private function
0113     function __privateFunction() {}
0114 
0115     Item {
0116     }
0117 
0118     Item {}
0119 
0120     property /* foo */ int /* bar */ weirdProperty /* baz */ : /* foo */ 12
0121 }