kreshuklab / plant-seg

A tool for cell instance aware segmentation in densely packed 3D volumetric images
https://kreshuklab.github.io/plant-seg/
MIT License
88 stars 31 forks source link

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

Closed qin-yu closed 4 months ago

qin-yu commented 5 months ago

image

qin-yu commented 4 months ago

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?

tlambert03 commented 4 months ago

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 commented 4 months ago

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!

tlambert03 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

image