Run QtQuickControls gallery, click in the menu. Fusion style works fine, Oxygen and Breeze break. Not sure of the cause yet.
I guess it has to do with how "subitems" are positioned. I'll see how it is done in fusion and compare. There is a chance also that qtquickcontrols does not allocate the correct size (sizeFromContents) actually requested (expected) by the style for rendering the menu ... Will keep you posted.
ah, looks that way. The controls do sizeFromContents() on only the text. QtQuickControls Styles/Desktop/MenuStyle.qml: 96 Will check tomorrow, and if that's the cause try and fix Qt. Thanks.
Actually, same is true for widgets (meaning that only the text length is passed to the sizeFromContents method), and the icon size is added manually, based on menuItemOption->maxIconWidth). I'll double check whether this guy is passed properly for QtQuickControls, or if another variable is used.
ok. Above method (maxIconSize) returns zero for qtquickcontrols, which explains the issue Fusion (qcommonstyle), qmax it with PM_SmallIconSize). So I'll implement that and commit
Git commit 9e79d94d43542b6228743533a8d042b9029dc799 by Hugo Pereira Da Costa. Committed on 16/09/2014 at 09:38. Pushed by hpereiradacosta into branch 'master'. Use PM_SmallIconSize together with menuItemOption->maxIconSize to layout menuitems. This workarounds the fact that the latter variable is set to zero for qtquickcontrols. M +2 -2 kstyle/breezestyle.cpp http://commits.kde.org/breeze/9e79d94d43542b6228743533a8d042b9029dc799
Git commit ea9265ea7f32c2201f121f2380284e2d6963c7ef by Hugo Pereira Da Costa. Committed on 16/09/2014 at 09:42. Pushed by hpereiradacosta into branch 'master'. Use PM_SmallIconSize together with menuItemOption->maxIconSize to layout menuitems. This workarounds the fact that the latter variable is set to zero for qtquickcontrols. M +3 -2 kstyle/oxygenstyle.cpp http://commits.kde.org/oxygen/ea9265ea7f32c2201f121f2380284e2d6963c7ef
That fixes it, but ... I'm not happy with the change: 1st: the menu items are now way too large because there is extra space added for possible checkboxes, even if there is no checkboxes, this because menuItemOption->menuHasCheckableItems is always true. Also on the widget side, you would now always have extra space for the icon, this even if there is no single icon set in the menu ... All in all both issues would rather lie in the filling of the option passed to SizeFromContents by qtquickcontrols, which is incomplete. I guess it would be better to have this fixed upstream, if possible, and the change reverted. My 2 cents
Hugo, could you report your findings to https://bugreports.qt-project.org/ ?
Done: https://bugreports.qt-project.org/browse/QTBUG-41652
Git commit 0cce762f03a017923bc5c29935a2fa9cbd9c35a1 by Hugo Pereira Da Costa. Committed on 03/09/2015 at 09:35. Pushed by hpereiradacosta into branch 'Plasma/5.4'. Only use fixed icon size for QtQuickControls In other cases (standard widgets) use maxIconSize M +13 -2 kstyle/breezestyle.cpp http://commits.kde.org/breeze/0cce762f03a017923bc5c29935a2fa9cbd9c35a1
Git commit 684e71ab0dcdbda62d508c2432890aec936a55f1 by Hugo Pereira Da Costa. Committed on 03/09/2015 at 09:34. Pushed by hpereiradacosta into branch 'master'. Only use fixed icon size for QtQuickControls In other cases (standard widgets) use maxIconSize M +13 -2 kstyle/breezestyle.cpp http://commits.kde.org/breeze/684e71ab0dcdbda62d508c2432890aec936a55f1
Git commit 84872f2f58e4e3fa9197cc528e32d42c5f7450fa by Hugo Pereira Da Costa. Committed on 03/09/2015 at 09:43. Pushed by hpereiradacosta into branch 'Plasma/5.4'. Only use fixed icon size for QtQuickControls In other cases (standard widgets) use maxIconSize M +11 -1 kstyle/oxygenstyle.cpp http://commits.kde.org/oxygen/84872f2f58e4e3fa9197cc528e32d42c5f7450fa
Git commit b3c754678cac6e87c2645543ad069364bcb54982 by Hugo Pereira Da Costa. Committed on 03/09/2015 at 09:42. Pushed by hpereiradacosta into branch 'master'. Only use fixed icon size for QtQuickControls In other cases (standard widgets) use maxIconSize M +11 -1 kstyle/oxygenstyle.cpp http://commits.kde.org/oxygen/b3c754678cac6e87c2645543ad069364bcb54982
Closing this bug report. This is the best we can do (workaround), until the actual bug in Qt is fixed.