Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@
Superqt includes a workaround for this issue, but it is not perfect, and it requires using a custom stylesheet (which may interfere with your own styles). Note that you
may not see this issue if you're already using custom stylesheets.

To opt in to the workaround, do any of the following:
To opt in to the workaround, do either of the following:

- set the environment variable `USE_MAC_SLIDER_PATCH=1` before importing superqt
(note: this is safe to use even if you're targeting more than just MacOS 12, it will only be applied when needed)
- call the `applyMacStylePatch()` method on any of the superqt slider subclasses (note, this will override your slider styles)
- apply the stylesheet manually:

```python
from superqt.sliders import MONTEREY_SLIDER_STYLES_FIX

slider.setStyleSheet(MONTEREY_SLIDER_STYLES_FIX)
```
19 changes: 17 additions & 2 deletions src/superqt/sliders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import warnings
from typing import Any

from ._generic_slider import MONTEREY_SLIDER_STYLES_FIX as _MONTEREY_STYLES
from ._labeled import (
QLabeledDoubleRangeSlider,
QLabeledDoubleSlider,
QLabeledRangeSlider,
QLabeledSlider,
)
from ._range_style import MONTEREY_SLIDER_STYLES_FIX
from ._sliders import QDoubleRangeSlider, QDoubleSlider, QRangeSlider

__all__ = [
"MONTEREY_SLIDER_STYLES_FIX",
"QDoubleRangeSlider",
"QDoubleSlider",
"QLabeledDoubleRangeSlider",
Expand All @@ -17,3 +19,16 @@
"QLabeledSlider",
"QRangeSlider",
]


def __getattr__(name: str) -> Any:
if name == "MONTEREY_SLIDER_STYLES_FIX":
warnings.warn(
"MONTEREY_SLIDER_STYLES_FIX is deprecated and will be removed in a "
"future version. Call `applyMacStylePatch()` on the slider instead, "
"or set the `USE_MAC_SLIDER_PATCH=1` environment variable.",
DeprecationWarning,
stacklevel=2,
)
return _MONTEREY_STYLES
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Loading
Loading