pyapp-kit / superqt

Missing widgets and components for Qt-python
https://pyapp-kit.github.io/superqt/
BSD 3-Clause "New" or "Revised" License
210 stars 38 forks source link

Slider labels clipping in high resolution screens #26

Open MosGeo opened 3 years ago

MosGeo commented 3 years ago

Describe the bug The labels of the range sliders are clipped when displayed on high resolution screens. You can see in the snapshots that even at 100% scaling in the Surface Book 3 (3240x2160 recommended resolution), it is clipping the labels. The issue is even worse at 200% scaling (which is the recommended scaling for this screen).

To Reproduce Steps to reproduce the behavior:

  1. Create a napari dock widget with a QVBoxLayout
  2. Add a QLabeledRangeSlider
  3. Add the widget to napari
  4. Labels are clipped as in the picture example

A simple example code

self.layout = QVBoxLayout()
histogram_slider = QLabeledRangeSlider()
histogram_slider.setRange(0,255)
histogram_slider.setOrientation(Qt.Orientation.Horizontal)
self.layout.addWidget(histogram_slider)

Expected behavior Labels are automatically scaled to the screen and are not clipped.

Screenshots Slider at recommended scaling (200%) 200_percent_scaling_recommended

Sliders at not-recommended scaling (100%) 100_percent_scaling

Desktop (please complete the following information):

tlambert03 commented 3 years ago

Thanks, can you also tell me what version of Qt you're on? I think we've seen this before and found that it's been fixed in newer versions of Qt, but I'm not sure

tlambert03 commented 3 years ago

Linking https://github.com/napari/napari/issues/3221 for reference, where I think we saw the same thing on qt 5.12

MosGeo commented 3 years ago

I am using the latest version of PyQt==5.15.4. Looks like the napari issue is the same.

Edit: upon reading through the napari issue, I just wanted to note that I am using pip and that is why napari installed the latest PyQt.

tlambert03 commented 3 years ago

Thanks for checking. Just for the sake of completeness, could you give me the output of conda list?

MosGeo commented 3 years ago

I am using pip virtual environment (venv) not conda. The virtual environment:

Package Version


aicsimageio 4.2.0
aicspylibczi 3.0.3
aiohttp 3.7.4.post0 alabaster 0.7.12
appdirs 1.4.4
arrow 1.1.1
asciitree 0.3.3
astroid 2.8.0 async-timeout 3.0.1 attrs 21.2.0 Babel 2.9.1 backcall 0.2.0 binaryornot 0.4.4 cachey 0.2.1 certifi 2021.5.30 chardet 4.0.0 charset-normalizer 2.0.6 click 8.0.1 cloudpickle 2.0.0 colorama 0.4.4 cookiecutter 1.7.3 cycler 0.10.0 dask 2021.9.1 debugpy 1.4.3 decorator 5.1.0 dnspython 2.1.0 docstring-parser 0.10 docutils 0.17.1 elementpath 2.3.2 email-validator 1.1.3 entrypoints 0.3 fasteners 0.16.3 freetype-py 2.2.0 fsspec 2021.8.1 HeapDict 1.0.1 hsluv 5.0.2 idna 3.2 imagecodecs 2021.8.26 imageio 2.9.0 imageio-ffmpeg 0.4.5 imagesize 1.2.0 ipykernel 6.4.1 ipython 7.27.0 ipython-genutils 0.2.0 isort 5.9.3 jedi 0.18.0 Jinja2 3.0.1 jinja2-time 0.2.0 jsonschema 3.2.0 jupyter-client 7.0.3 jupyter-core 4.8.1 kiwisolver 1.3.2 lazy-object-proxy 1.6.0 locket 0.2.1 lxml 4.6.3 magicgui 0.2.11 MarkupSafe 2.0.1 matplotlib 3.4.3 matplotlib-inline 0.1.3 mccabe 0.6.1 multidict 5.1.0 napari 0.4.11 napari-aicsimageio 0.4.1 napari-console 0.0.4 napari-plugin-engine 0.2.0 napari-svg 0.1.5 nest-asyncio 1.5.1 networkx 2.6.3 numcodecs 0.9.1 numpy 1.21.2 numpydoc 1.1.0 ome-types 0.2.9 opencv-python 4.5.3.56 packaging 21.0 pandas 1.3.3 parso 0.8.2 partd 1.2.0 pickleshare 0.7.5 Pillow 8.3.2 Pint 0.17 pip 21.2.4 platformdirs 2.3.0 pooch 1.5.1 poyo 0.5.0 prompt-toolkit 3.0.20 psutil 5.8.0 pydantic 1.8.2 Pygments 2.10.0 pylint 2.11.1 PyOpenGL 3.1.5 pyparsing 2.4.7 PyQt5 5.15.4 PyQt5-Qt5 5.15.2 PyQt5-sip 12.9.0 pyrsistent 0.18.0 python-dateutil 2.8.2 python-slugify 5.0.2 pytz 2021.1 PyWavelets 1.1.1 pywin32 301 PyYAML 5.4.1 pyzmq 22.3.0 qtconsole 5.1.1 QtPy 1.11.2 readlif 0.6.2 requests 2.26.0 scikit-image 0.18.3 scipy 1.7.1 setuptools 58.1.0 six 1.16.0 snowballstemmer 2.1.0 Sphinx 4.2.0 sphinxcontrib-applehelp 1.0.2 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 superqt 0.2.4 text-unidecode 1.3 tifffile 2021.8.30 toml 0.10.2 toolz 0.11.1 tornado 6.1 tqdm 4.62.3 traitlets 5.1.0 typing-extensions 3.10.0.2 urllib3 1.26.7 vispy 0.8.1 wcwidth 0.2.5 wheel 0.37.0 wrapt 1.12.1 xarray 0.16.2 xmlschema 1.7.1 yarl 1.6.3 zarr 2.10.0

MehradN commented 2 years ago

I also have a similar problem, the numbers on top of the QLabeledRangeSlider will clip when they get near the edges of the slider image image