Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Napari UI: Widgets too wide yet don't have enough space for numbers to show #213

Closed
qin-yu opened this issue Mar 12, 2024 · 6 comments · Fixed by #227
Closed

Napari UI: Widgets too wide yet don't have enough space for numbers to show #213

qin-yu opened this issue Mar 12, 2024 · 6 comments · Fixed by #227
Assignees
Labels
bug Something isn't working GUI Napari GUI related

Comments

@qin-yu
Copy link
Collaborator

qin-yu commented Mar 12, 2024

image

@qin-yu qin-yu added bug Something isn't working GUI Napari GUI related labels Apr 15, 2024
@qin-yu qin-yu changed the title Widgets too wide yet don't have enough space for numbers to show Napari UI: Widgets too wide yet don't have enough space for numbers to show Apr 28, 2024
@qin-yu
Copy link
Collaborator Author

qin-yu commented Apr 28, 2024

Hi @tlambert03, I need your help again!

I am aiming to adjust the font size via label styling for the FloatRangeSlider (derived from superqt's QLabeledRangeSlider?). I've reviewed the existing code, but found the implementation somewhat complex. Before I delve deeper, I wanted to reach out for your guidance. Could you provide any pointers on how I might approach this?

@qin-yu qin-yu self-assigned this Apr 28, 2024
@tlambert03
Copy link
Contributor

fwiw, this really is a napari issue, and not something that you should be having to worry about. The issue is that napari doesn't do a great job of detecting display scaling (because it's a legitimately hard thing to do). is it safe to assume you're on windows? that's really where this will show up the most.

One warning: if you try to fix this by hard-setting a font size based on what you see on your monitor, it's very likely that you'll be ruining it for another monitor (like a linux/macos system for which display scaling is better detected by Qt), so I'd encourage you to try to test whatever fix you come up with on different OSes

that said... to just adjust the font size, did you already try some_slider.setStyleSheet("font-size: 8pt;") ? that should work

@qin-yu
Copy link
Collaborator Author

qin-yu commented Apr 28, 2024

I'm running this through VNC on a Linux server, with displays eventually outputting to Windows/macOS machines at work/home. It seems that changing the font size doesn't have any effect, possibly due to the lack of a defined screen resolution, and I've configured the VNC to adjust interface window size responsively.

Given these circumstances, I think it's best to leave this issue as is. I'll mark it as "won't fix" for now. Your assistance has been invaluable—otherwise I would spend days trying to tweak Qt styling : )

Thank you so much!

@qin-yu qin-yu added the wontfix This will not be worked on label Apr 28, 2024
@qin-yu qin-yu closed this as not planned Won't fix, can't repro, duplicate, stale Apr 28, 2024
@tlambert03
Copy link
Contributor

It seems that changing the font size doesn't have any effect

if i make a simple example of creating a QLabeledSlider and calling setStyleSheet, it does work for me. so if it's not working for you, the answer is more likely related to napari's styles overriding your styles somehow, and that gets much more complicated (and is probably something you should take up with napari)

@qin-yu
Copy link
Collaborator Author

qin-yu commented Apr 28, 2024

Ohhh, thanks @tlambert03! The stylesheet you provided is perfect. Initially, I was using .setStyleSheet("QLabel { font-size: 8pt; }"), guided by the examples at Qt Style Sheet Examples, which unfortunately didn't work in my setup. Your solution resolved the issue completely—now it's fixed! I really appreciate your help!

@qin-yu qin-yu reopened this Apr 28, 2024
@qin-yu qin-yu removed the wontfix This will not be worked on label Apr 28, 2024
@qin-yu
Copy link
Collaborator Author

qin-yu commented Apr 28, 2024

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI Napari GUI related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants