QDarkStyleSheet icon indicating copy to clipboard operation
QDarkStyleSheet copied to clipboard

Enhance spacing in menu with/without icons/indicators - overlaps

Open dpizetta opened this issue 4 years ago • 2 comments

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

win-qt512 win-qt513 win-qt514 win-qt515

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.

win-qt512-workaround

dpizetta avatar Jan 20 '20 18:01 dpizetta

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

dpizetta avatar Mar 30 '21 20:03 dpizetta

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));

PhenomRetroShare avatar Apr 15 '21 16:04 PhenomRetroShare