'How to properly scale qgroupbox title with stylesheet for high resolution display?
I'm trying to apply a stylesheet for a QGroupBox (qt 4.8), which works on normal screens (96dpi) as well as on high-resolution screens (yoga 2 pro, 3200x1800, 275dpi, windows 8.1).
The following style looks good on the 275dpi screen, but on a regular 96dpi screen the top margin is by far too huge.
QGroupBox
{
border: 1px solid red;
border-radius: 7px;
margin-top: 12ex;
}
QGroupBox::title
{
subcontrol-origin: margin;
subcontrol-position: top left;
padding-left: 10px;
padding-right: 10px;
}
Changing the top-margin has an effect, but I can't find a proper setting that works on both screens. If I make the value smaller, the content of the groupbox overlaps with the title on the 275dpi screen. I was also playing with the units "ex", "px", "mx", "pt". Reading the documentation I would have guessed, that "2ex" was the correct solution, which should scale with the different screen resolution.
Without stylesheet, the groupbox works well on both screens.
How do I properly design my stylesheet?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
