Closed probonopd closed 1 year ago
We need to do something in styleplugin/basestyle.cpp
m.topMargin = 2; // static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);
m.bottomMargin = 2; // static_cast<int>(fontHeight * MenuItem_VerticalMarginsFontRatio);
This seems to fix the menu item height. Although we might want to hardcode the menu item height to an exact number of pixels instead of calculating it based on the font size; especially if we hardcode the absolute pixel height of the MainWindow that contains the menu. However, keep in mind that for non-global menus different font sizes and hence different menu item heights may be desirable.
For the menu(bar) height we need to change:
case CT_MenuBarItem: {
return QSize(size.width() + 10, 22);
}
This hardcodes the height to 22px. Note that this value should always be kept the same as the height of the MainWindow of the Menu application. Can we make the MainWindow of the Menu application find out the height of the CT_MenuBarItem and just use that?
Text is still not centered.
Defined by:
CT_MenuBarItem
(in helloSystem, we want 22px)CT_MenuBarItem
(in helloSystem, we want 22px/2)MenuBar_ItemSpacing
(in helloSystem, we want close to 0px)MenuItemMetrics
totalHeight
(in helloSystem, we want this depending on the font size; for the main menu we want 22px)MainWindow
height
Turns out we get different rendering of text in Debian vs. FreeBSD; the reason for this is not clear yet. Using an ugly ifdef for now: https://github.com/helloSystem/QtPlugin/commit/02361cec140e4899b2202d39ab3c6b58dc793fba
Also noteworthy: The Nimbus Sans in Debian/Ubuntu (fonts-urw-base35) behaves very differently than the Nimbus Sans from https://github.com/ArtifexSoftware/urw-base35-fonts/archive/20200910.zip. When using the latter in both places, I get consistent results. Hence closing.
On Debian Sid with Qt version 5.15.2, text is not vertically centered.
Menu items have too large height. Unlike on FreeBSD, using the exact same fonts.
Why the difference?
This is not caused by /etc/xdg/stylesheet.qss because the effect is there even without it. The Qt Unix default theme does not have this issue.