Repository: napari/napari

Issue:
QSpinBox issue with QT 5.9.6
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
When trying to use napari on a Windows 10 machine with QT version 5.9.6 I get the following error:
`AttributeError: 'QtCustomDoubleSpinBox' object has no attribute 'setStepType'`. Looks like `setStepType` was [added in Qt 5.12](https://doc.qt.io/qt-5/qspinbox.html#setStepType). I can upgrade Qt and give this another go, but I wanted to document it here in case others run into the same issue.

Steps to reproduce the behavior:

1. clone from github
2. `pip install -r requirements.txt`
3. `pip install -e .`
4. `napari`
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->
```
  File "C:\Users\Peter\Anaconda3\Scripts\napari-script.py", line 11, in <module>
    load_entry_point('napari', 'console_scripts', 'napari')()
  File "c:\users\peter\source\repos\napari\napari\__main__.py", line 54, in main
    v = Viewer()
  File "c:\users\peter\source\repos\napari\napari\viewer.py", line 61, in __init__
    qt_viewer = QtViewer(self)
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_viewer.py", line 55, in __init__
    self.dims = QtDims(self.viewer.dims)
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims.py", line 58, in __init__
    self._update_nsliders()
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims.py", line 160, in _update_nsliders
    self._create_sliders(self.dims.ndim)
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims.py", line 214, in _create_sliders
    slider_widget = QtDimSliderWidget(self, dim_axis)
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims_slider.py", line 86, in __init__
    self._create_play_button_widget()
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims_slider.py", line 145, in _create_play_button_widget
    self.play_button = QtPlayButton(self.qt_dims, self.axis)
  File "c:\users\peter\source\repos\napari\napari\_qt\qt_dims_slider.py", line 366, in __init__
    fpsspin.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType)
AttributeError: 'QtCustomDoubleSpinBox' object has no attribute 'setStepType'
```

I appreciate that you mention QT versions on startup...this is helpful.



Discussion:
Thanks for reporting, I'll fix that.  I'm surprised, however, that when you `pip install requirements` you're getting qt 5.9.  Our requirements.txt specifies `PySide2>=5.12.3`... did you already have an environment setup?

Resolving patch:
diff --git a/napari/_qt/qt_dims_slider.py b/napari/_qt/qt_dims_slider.py
--- a/napari/_qt/qt_dims_slider.py
+++ b/napari/_qt/qt_dims_slider.py
@@ -363,7 +363,9 @@ def __init__(self, dims, axis, reverse=False, fps=10, mode=LoopMode.LOOP):
         fpsspin = QtCustomDoubleSpinBox(self.popup)
         fpsspin.setAlignment(Qt.AlignCenter)
         fpsspin.setValue(self.fps)
-        fpsspin.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType)
+        if hasattr(fpsspin, 'setStepType'):
+            # this was introduced in Qt 5.12.  Totally optional, just nice.
+            fpsspin.setStepType(QDoubleSpinBox.AdaptiveDecimalStepType)
         fpsspin.setMaximum(500)
         fpsspin.setMinimum(0)
         self.popup.form_layout.insertRow(


Test patch: