Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] Show a modal progress dialog when running algorithms
which cannot run in background tasks This is not fantastic UX, but we have lots of constraints here: - The algorithm dialog itself cannot be made modal. There's child widgets (such as the point and extent parameter widgets) which interact with the main QGIS window. - There is no reliable way in Qt to make a dialog modal after it's shown (e.g. make it modal only when the algorithm is running). Trust me - I've tried everything, and all approaches break with some corner case. - For non-background algorithms, we must have processEvents calls in order to show the algorithm feedback and progress to users, and detect cancel button clicks. Yet these processEvents calls means that users can interact with other parts of QGIS, e.g. removing layers from a project, and other operations which could cause the algorithm to crash. So we MUST have some modal dialog in order to block interactions outside of allowing the cancel button clicks/progress repainting. I've tried many approaches, but this is the only one which works reliably...
- Loading branch information
Showing
with
180 additions
and 7 deletions.
- +7 −0 python/gui/processing/qgsprocessingalgorithmdialogbase.sip
- +18 −6 python/plugins/processing/gui/AlgorithmDialog.py
- +50 −0 src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
- +50 −1 src/gui/processing/qgsprocessingalgorithmdialogbase.h
- +55 −0 src/ui/processing/qgsprocessingalgorithmprogressdialogbase.ui
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsProcessingProgressDialogBase</class> | ||
<widget class="QDialog" name="QgsProcessingProgressDialogBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>1603</width> | ||
<height>1239</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<property name="sizeGripEnabled"> | ||
<bool>true</bool> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QTextEdit" name="mTxtLog"> | ||
<property name="readOnly"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0"> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="QProgressBar" name="mProgressBar"> | ||
<property name="value"> | ||
<number>0</number> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QDialogButtonBox" name="mButtonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |