New custom widgets for Float and Int parameters
Summary
Rewrite numerical parameter widgets of otbgui to provide several improvements.
Before:
After:
- Add a new "clear" button, visible only when applicable, inspired by QGIS's QgsSpinBox
- Remove the reset button
- Disable the scroll wheel event to avoid conflict with the parent QScrollArea
- Use variable length decimal input to avoid ugly trailing zeros.
- Fix the Qt issue where the user could not type digits because the spinbox was already full.
- Fix user value flag not reset when reset button is pressed
- Fix DoUpdateGUI spaghetti code (don't call it on children in QtWidgetGroupParameter)
- Don't highlight on select
- Only call application's DoUpdateParameters when editing is finished, not on every keystroke.
- Add
Qt5Svg
dependency to SuperBuild (needed to read the svg icon file).
Rationale
Better otbgui UX.
Implementation Details
Classes and files
M Modules/ThirdParty/Qt/CMakeLists.txt
M Modules/ThirdParty/Qt/otb-module-init.cmake
M Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetFloatParameter.h
M Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetIntParameter.h
M Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetModel.h
M Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetParameterBase.h
A Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSpinBoxes.h
M Modules/Wrappers/QtWidget/src/CMakeLists.txt
M Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetFloatParameter.cxx
A Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetIcons.qrc
M Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetIntParameter.cxx
M Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterBase.cxx
M Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetParameterGroup.cxx
A Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSpinBoxes.cxx
M SuperBuild/CMake/External_qt5.cmake
A Utilities/Data/Icons/mIconClearText.svg
A Utilities/Data/Icons/mIconClearTextHover.svg
Applications
NA.
Tests
NA.
Documentation
NA.
Additional notes
- There is a significant amount of duplicated code between
otbWrapperQtWidgetIntParameter
andotbWrapperQtWidgetFloatParameter
. This is not addressed by this MR. Unfortunately I think that the fix is more complex than simply moving the common code to a base class. Might be possible with multiple inheritance of an interface common toQtWidgetSpinBox
andQtWidgetDoubleSpinBox
. - The new float widget does not show decimal points for float values that are also integers. This may confuse users who will not figure out that they are allowed to input non-integer values. Similarly, because the new LineEdit allows all input and only clears it when focus is lost, users might enter decimal values in int parameter, only to be confused why their input is being truncated.
- As a fundamental limitation of IEEE float, there will be loss of precision (and therefore weird GUI behavior) beyond 6 decimal digits in float inputs. It is not possible to go around this without also changing application engine's floats to doubles.
Copyright
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement
Edited by Victor Poughon