Add Window browseChanged signal as replacement for openFileChanged
Showing the changes to interface/src/scripting/WindowScriptingInterface.h (1 of 3 files). Show all
Unified · Split
| @@ -197,18 +197,19 @@ public slots: · 196 unmodified lines | |||
| 197 | 197 | ||
| 198 | /**jsdoc | 198 | /**jsdoc |
| 199 | * Prompt the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A | 199 | * Prompt the user to choose a file. Displays a non-modal dialog that navigates the directory tree. A |
| 200 | * {@link Window.openFileChanged|openFileChanged} signal is emitted when a file is chosen; no signal is emitted if the user | 200 | * {@link Window.browseChanged|browseChanged} signal is emitted when a file is chosen; no signal is emitted if the user |
| 201 | * cancels the dialog. | 201 | * cancels the dialog. |
| 202 | * @deprecated A deprecated {@link Window.openFileChanged|openFileChanged} signal is also emitted when a file is chosen. | ||
| 202 | * @function Window.browseAsync | 203 | * @function Window.browseAsync |
| 203 | * @param {string} title="" - The title to display at the top of the dialog. | 204 | * @param {string} title="" - The title to display at the top of the dialog. |
| 204 | * @param {string} directory="" - The initial directory to start browsing at. | 205 | * @param {string} directory="" - The initial directory to start browsing at. |
| 205 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and | 206 | * @param {string} nameFilter="" - The types of files to display. Examples: <code>"*.json"</code> and |
| 206 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. | 207 | * <code>"Images (*.png *.jpg *.svg)"</code>. All files are displayed if a filter isn't specified. |
| 207 | * @example <caption>Ask the user to choose an image file without waiting for the answer.</caption> | 208 | * @example <caption>Ask the user to choose an image file without waiting for the answer.</caption> |
| 208 | * function onOpenFileChanged(filename) { | 209 | * function onBrowseChanged(filename) { |
| 209 | * print("File: " + filename); | 210 | * print("File: " + filename); |
| 210 | * } | 211 | * } |
| 211 | * Window.openFileChanged.connect(onOpenFileChanged); | 212 | * Window.browseChanged.connect(onBrowseChanged); |
| 212 | * | 213 | * |
| 213 | * Window.browseAsync("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); | 214 | * Window.browseAsync("Select Image File", Paths.resources, "Images (*.png *.jpg *.svg)"); |
| 214 | * print("Script continues without waiting"); | 215 | * print("Script continues without waiting"); |
| @@ -659,9 +660,18 @@ signals: · 444 unmodified lines | |||
| 659 | */ | 660 | */ |
| 660 | void saveFileChanged(QString filename); | 661 | void saveFileChanged(QString filename); |
| 661 | 662 | ||
| 663 | /**jsdoc | ||
| 664 | * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. | ||
| 665 | * @function Window.browseChanged | ||
| 666 | * @param {string} filename - The path and name of the file the user chose in the dialog. | ||
| 667 | * @returns {Signal} | ||
| 668 | */ | ||
| 669 | void browseChanged(QString filename); | ||
| 670 | |||
| 662 | /**jsdoc | 671 | /**jsdoc |
| 663 | * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. | 672 | * Triggered when the user chooses a file in a {@link Window.browseAsync|browseAsync} dialog. |
| 664 | * @function Window.openFileChanged | 673 | * @function Window.openFileChanged |
| 674 | * @deprecated This signal is being replaced with {@link Window.browseChanged|browseChanged} and will be removed. | ||
| 665 | * @param {string} filename - The path and name of the file the user chose in the dialog. | 675 | * @param {string} filename - The path and name of the file the user chose in the dialog. |
| 666 | * @returns {Signal} | 676 | * @returns {Signal} |
| 667 | */ | 677 | */ |