Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -16,6 +16,8 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #include <SettingHandle.h> |
| 18 | 18 | |
| 19 | +#include <display-plugins/CompositorHelper.h> | |
| 20 | + | |
| 19 | 21 | #include "Application.h" |
| 20 | 22 | #include "DomainHandler.h" |
| 21 | 23 | #include "MainWindow.h" |
| @@ -147,6 +149,15 @@ void WindowScriptingInterface::setPreviousBrowseLocation(const QString& location · 125 unmodified lines | ||
| 147 | 149 | Setting::Handle<QVariant>(LAST_BROWSE_LOCATION_SETTING).set(location); |
| 148 | 150 | } |
| 149 | 151 | |
| 152 | +/// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and | |
| 153 | +/// might be in same thread as a script that sets the reticle to invisible | |
| 154 | +void WindowScriptingInterface::ensureReticleVisible() const { | |
| 155 | + auto compositorHelper = DependencyManager::get<CompositorHelper>(); | |
| 156 | + if (!compositorHelper->getReticleVisible()) { | |
| 157 | + compositorHelper->setReticleVisible(true); | |
| 158 | + } | |
| 159 | +} | |
| 160 | + | |
| 150 | 161 | /// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current |
| 151 | 162 | /// working directory. |
| 152 | 163 | /// \param const QString& title title of the window |
| @@ -154,6 +165,7 @@ void WindowScriptingInterface::setPreviousBrowseLocation(const QString& location · 1 unmodified line | ||
| 154 | 165 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 155 | 166 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` |
| 156 | 167 | QScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) { |
| 168 | + ensureReticleVisible(); | |
| 157 | 169 | QString path = directory; |
| 158 | 170 | if (path.isEmpty()) { |
| 159 | 171 | path = getPreviousBrowseLocation(); |
| @@ -175,6 +187,7 @@ QScriptValue WindowScriptingInterface::browse(const QString& title, const QStrin · 15 unmodified lines | ||
| 175 | 187 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 176 | 188 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` |
| 177 | 189 | QScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) { |
| 190 | + ensureReticleVisible(); | |
| 178 | 191 | QString path = directory; |
| 179 | 192 | if (path.isEmpty()) { |
| 180 | 193 | path = getPreviousBrowseLocation(); |