Update Clipboard and Menu JSDoc to use JavaScript type names

This commit is contained in:
David Rowe 2017-11-11 07:55:57 +13:00
parent 036ac8de6d
commit c77a12f5fa
3 changed files with 48 additions and 48 deletions

View file

@ -38,7 +38,7 @@ public:
/**jsdoc
* Compute the largest dimension of the extents of the contents held in the clipboard.
* @function Clipboard.getClipboardContentsLargestDimension
* @returns {float} The largest dimension computed.
* @returns {Number} The largest dimension computed.
*/
Q_INVOKABLE float getClipboardContentsLargestDimension();
@ -46,29 +46,29 @@ public:
* Import entities from a JSON file containing entity data into the clipboard.
* You can generate a JSON file using {@link Clipboard.exportEntities}.
* @function Clipboard.importEntities
* @param {string} filename Path and name of file to import.
* @returns {bool} `true` if the import was successful, otherwise `false`.
* @param {String} filename Path and name of file to import.
* @returns {Boolean} `true` if the import was successful, otherwise `false`.
*/
Q_INVOKABLE bool importEntities(const QString& filename);
/**jsdoc
* Export the entities specified to a JSON file.
* @function Clipboard.exportEntities
* @param {string} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {String} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {EntityID[]} entityIDs IDs of entities to export.
* @returns {bool} `true` if the export was successful, otherwise `false`.
* @returns {Boolean} `true` if the export was successful, otherwise `false`.
*/
Q_INVOKABLE bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
/**jsdoc
* Export the entities with centers within a cube to a JSON file.
* @function Clipboard.exportEntities
* @param {string} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {float} x X-coordinate of the cube center.
* @param {float} y Y-coordinate of the cube center.
* @param {float} z Z-coordinate of the cube center.
* @param {float} scale Half dimension of the cube.
* @returns {bool} `true` if the export was successful, otherwise `false`.
* @param {String} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {Number} x X-coordinate of the cube center.
* @param {Number} y Y-coordinate of the cube center.
* @param {Number} z Z-coordinate of the cube center.
* @param {Number} scale Half dimension of the cube.
* @returns {Boolean} `true` if the export was successful, otherwise `false`.
*/
Q_INVOKABLE bool exportEntities(const QString& filename, float x, float y, float z, float scale);

View file

@ -55,23 +55,23 @@ public slots:
/**jsdoc
* Add a new top-level menu.
* @function Menu.addMenu
* @param {string} menuName Name that will be displayed for the menu.
* @param {string} [grouping] Name of the grouping, if any, to add this menu to.
* @param {String} menuName Name that will be displayed for the menu.
* @param {String} [grouping] Name of the grouping, if any, to add this menu to.
*/
void addMenu(const QString& menuName, const QString& grouping = QString());
/**jsdoc
* Remove a top-level menu.
* @function Menu.removeMenu
* @param {string} menuName Name of the menu to remove.
* @param {String} menuName Name of the menu to remove.
*/
void removeMenu(const QString& menuName);
/**jsdoc
* Check whether a top-level menu exists.
* @function Menu.menuExists
* @param {string} menuName Name of the menu to check for existence.
* @returns {bool} `true` if the menu exists, otherwise `false`.
* @param {String} menuName Name of the menu to check for existence.
* @returns {Boolean} `true` if the menu exists, otherwise `false`.
*/
bool menuExists(const QString& menuName);
@ -79,16 +79,16 @@ public slots:
* Add a separator with an unclickable label below it.
* The line will be placed at the bottom of the menu.
* @function Menu.addSeparator
* @param {string} menuName Name of the menu to add a separator to.
* @param {string} separatorName Name of the separator that will be displayed as the label below the separator line.
* @param {String} menuName Name of the menu to add a separator to.
* @param {String} separatorName Name of the separator that will be displayed as the label below the separator line.
*/
void addSeparator(const QString& menuName, const QString& separatorName);
/**jsdoc
* Remove a separator from a menu.
* @function Menu.removeSeparator
* @param {string} menuName Name of the menu to remove the separator from.
* @param {string} separatorName Name of the separator to remove.
* @param {String} menuName Name of the menu to remove the separator from.
* @param {String} separatorName Name of the separator to remove.
*/
void removeSeparator(const QString& menuName, const QString& separatorName);
@ -102,9 +102,9 @@ public slots:
/**jsdoc
* Add a new menu item to a menu.
* @function Menu.addMenuItem
* @param {string} menuName Name of the menu to add a menu item to.
* @param {string} menuItem Name of the menu item. This is what will be displayed in the menu.
* @param {string} [shortcutKey] A shortcut key that can be used to trigger the menu item.
* @param {String} menuName Name of the menu to add a menu item to.
* @param {String} menuItem Name of the menu item. This is what will be displayed in the menu.
* @param {String} [shortcutKey] A shortcut key that can be used to trigger the menu item.
*/
void addMenuItem(const QString& menuName, const QString& menuitem, const QString& shortcutKey);
void addMenuItem(const QString& menuName, const QString& menuitem);
@ -112,17 +112,17 @@ public slots:
/**jsdoc
* Remove a menu item from a menu.
* @function Menu.removeMenuItem
* @param {string} menuName Name of the menu to remove a menu item from.
* @param {string} menuItem Name of the menu item to remove.
* @param {String} menuName Name of the menu to remove a menu item from.
* @param {String} menuItem Name of the menu item to remove.
*/
void removeMenuItem(const QString& menuName, const QString& menuitem);
/**jsdoc
* Check if a menu item exists.
* @function Menu.menuItemExists
* @param {string} menuName Name of the menu that the menu item is in.
* @param {string} menuItem Name of the menu item to check for existence of.
* @returns {bool} `true` if the menu item exists, otherwise `false`.
* @param {String} menuName Name of the menu that the menu item is in.
* @param {String} menuItem Name of the menu item to check for existence of.
* @returns {Boolean} `true` if the menu item exists, otherwise `false`.
*/
bool menuItemExists(const QString& menuName, const QString& menuitem);
@ -136,23 +136,23 @@ public slots:
/**jsdoc
* Check whether a checkable menu item is checked.
* @function Menu.isOptionChecked
* @param {string} menuOption The name of the menu item.
* @returns {bool} `true` if the option is checked, otherwise false.
* @param {String} menuOption The name of the menu item.
* @returns {Boolean} `true` if the option is checked, otherwise false.
*/
bool isOptionChecked(const QString& menuOption);
/**jsdoc
* Set a checkable menu item as checked or unchecked.
* @function Menu.setIsOptionChecked
* @param {string} menuOption The name of the menu item to modify.
* @param {bool} isChecked If `true`, the menu item will be checked, otherwise it will not be checked.
* @param {String} menuOption The name of the menu item to modify.
* @param {Boolean} isChecked If `true`, the menu item will be checked, otherwise it will not be checked.
*/
void setIsOptionChecked(const QString& menuOption, bool isChecked);
/**jsdoc
* Trigger the menu item as if the user clicked on it.
* @function Menu.triggerOption
* @param {string} menuOption The name of the menu item to trigger.
* @param {String} menuOption The name of the menu item to trigger.
*/
void triggerOption(const QString& menuOption);
@ -160,16 +160,16 @@ public slots:
* Check whether a menu is enabled. If a menu is disabled it is grayed out and unusable.
* Menus are enabled by default.
* @function Menu.isMenuEnabled
* @param {string} menuName The name of the menu to check.
* @returns {bool} `true` if the menu is enabled, otherwise false.
* @param {String} menuName The name of the menu to check.
* @returns {Boolean} `true` if the menu is enabled, otherwise false.
*/
bool isMenuEnabled(const QString& menuName);
/**jsdoc
* Set a menu to be enabled or disabled. If a menu is disabled it is grayed out and unusable.
* @function Menu.setMenuEnabled
* @param {string} menuName The name of the menu to modify.
* @param {bool} isEnabled Whether the menu will be enabled or not.
* @param {String} menuName The name of the menu to modify.
* @param {Boolean} isEnabled Whether the menu will be enabled or not.
*/
void setMenuEnabled(const QString& menuName, bool isEnabled);
@ -183,7 +183,7 @@ signals:
/**jsdoc
* Notifies scripts when a menu item is clicked (or triggered by {@link Menu.triggerOption}).
* @function Menu.menuItemEvent
* @param {string} menuItem Name of the menu item that was clicked.
* @param {String} menuItem Name of the menu item that was clicked.
* @returns {Signal}
*/
void menuItemEvent(const QString& menuItem);

View file

@ -57,17 +57,17 @@ QScriptValue menuItemPropertiesToScriptValue(QScriptEngine* engine, const MenuIt
* position.
*
* @typedef {Object} Menu.MenuItemProperties
* @property {string} menuName Name of the menu.
* @property {string} menuItemName Name of the menu item.
* @property {bool} [isCheckable=false] Whether or not the menu item is checkable.
* @property {bool} [isChecked=false] Whether or not the menu item is checked.
* @property {bool} [isSeparator=false] Whether or not the menu item is a separator.
* @property {string} [shortcutKey] A shortcut key that triggers the menu item.
* @property {String} menuName Name of the menu.
* @property {String} menuItemName Name of the menu item.
* @property {Boolean} [isCheckable=false] Whether or not the menu item is checkable.
* @property {Boolean} [isChecked=false] Whether or not the menu item is checked.
* @property {Boolean} [isSeparator=false] Whether or not the menu item is a separator.
* @property {String} [shortcutKey] A shortcut key that triggers the menu item.
* @property {KeyEvent} [shortcutKeyEvent] A {@link KeyEvent} that specifies a key that triggers the menu item.
* @property {int} [position] The position to place the new menu item. `0` is the first menu item.
* @property {string} [beforeItem] The name of the menu item to place this menu item before.
* @property {string} [afterItem] The name of the menu item to place this menu item after.
* @property {string} [grouping] The name of grouping to add this menu item to.
* @property {Number} [position] The position to place the new menu item. An integer number with`0` being the first menu item.
* @property {String} [beforeItem] The name of the menu item to place this menu item before.
* @property {String} [afterItem] The name of the menu item to place this menu item after.
* @property {String} [grouping] The name of grouping to add this menu item to.
*/
void menuItemPropertiesFromScriptValue(const QScriptValue& object, MenuItemProperties& properties) {
properties.menuName = object.property("menuName").toVariant().toString();