QDarkStyleSheet
QDarkStyleSheet copied to clipboard
Enhance spacing in menu with/without icons/indicators - overlaps
Currently, on Windows 10 we have this behavior, that depends on the Qt version <=5.13, and >=5.14. This is a Qt problem that we have faced for a long time.
The main problem is that when there are only indicators on the menu (checkable actions) the space for the indicator is not reserved, and the text overlaps. However, if you have one icon attributed to any other action in the menu, space is reserved.
There is no way to check if there are indicators/icons to change the padding according to them.
If we add padding, all texts are shifted.
See the examples. More info about the versions is in the gifs. The order is: 5.[12,13,14,15].latest
WORKAROUND
Add a transparent icon to at least one action in the specific menu with the problem. I've tried to add a background/image background but it does not work. This should be a good way to keep the best spacing. I'll reopen a related problem in the Qt repository.
There are many issues and seems that fixing one thing breaks another.
- https://bugreports.qt.io/browse/QTBUG-55092
- https://bugreports.qt.io/browse/QTBUG-66380
- https://bugreports.qt.io/browse/QTBUG-74655
- https://bugreports.qt.io/browse/QTBUG-78238
- https://bugreports.qt.io/browse/QTBUG-80506
Hello, We have the same like behavior. I fix it replacing item delegate with:
QList<QComboBox*> widgetList = this->findChildren<QComboBox*>();
for(auto& it : widgetList)
it->setItemDelegate(new QStyledItemDelegate(it));