tsujan / Kvantum

A Linux SVG-based theme engine for Qt and KDE
1.6k stars 149 forks source link

menuitem size #362

Closed ghost closed 5 years ago

ghost commented 5 years ago

Selam! I want to squeeze menuitem height. For example, up to the font size. I try zero value frame padding ang text margin. But unsuccessed.

tsujan commented 5 years ago

The text you see doesn't define the height. Qt and other toolkits add a small spacing to the top and bottom and calculate the height based on the biggest letter, considering underlines, etc.

Anyhow, this is what you could use:

[MenuItem]
...
frame=false
text.margin.top=0
text.margin.bottom=0
ghost commented 5 years ago

https://u.teknik.io/WmHiR.png According to your config. Height is obviously greater than the largest letter + the subscript and superscript characters.

If use qss

QMenu::item {
    padding: 0px;
}

https://u.teknik.io/SYtCm.png But I can't use qss. Because I'll must write absolutely all widgets. If I don't make it I break half design.

tsujan commented 5 years ago

Apart from the fact that there are also other factors (like min_height, check box size,...), Kvantum never returns a size smaller than that of QCommonStyle. I've added this line intentionally:

  /* set the minimum to the default size */
  return s.expandedTo(defaultSize);

The above line is important because it respects what Qt considers the best size.

In QCommonStyle, we have:

h =  mi->fontMetrics.height() + 8;

QSS is not our concern because stylesheets are very different from QStyle.