Bug 339106 - Menu items icon + text overlap in QtQuickControls
Summary: Menu items icon + text overlap in QtQuickControls
Status: RESOLVED FIXED
Alias: None
Product: Breeze
Classification: Plasma
Component: QtQuickControls (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-15 21:51 UTC by David Edmundson
Modified: 2015-09-03 09:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edmundson 2014-09-15 21:51:18 UTC
Run QtQuickControls gallery, click in the menu.

Fusion style works fine, Oxygen and  Breeze break. Not sure of the cause yet.
Comment 1 Hugo Pereira Da Costa 2014-09-15 21:55:35 UTC
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.
Comment 2 David Edmundson 2014-09-15 22:15:50 UTC
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.
Comment 3 Hugo Pereira Da Costa 2014-09-16 09:28:45 UTC
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.
Comment 4 Hugo Pereira Da Costa 2014-09-16 09:37:04 UTC
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
Comment 5 Hugo Pereira Da Costa 2014-09-16 09:52:02 UTC
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
Comment 6 Hugo Pereira Da Costa 2014-09-16 09:55:00 UTC
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
Comment 7 Hugo Pereira Da Costa 2014-09-16 09:59:46 UTC
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
Comment 8 Christoph Feck 2014-09-28 17:42:56 UTC
Hugo, could you report your findings to https://bugreports.qt-project.org/ ?
Comment 9 Hugo Pereira Da Costa 2014-09-29 06:40:50 UTC
Done: https://bugreports.qt-project.org/browse/QTBUG-41652
Comment 10 Hugo Pereira Da Costa 2015-09-03 09:36:14 UTC
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
Comment 11 Hugo Pereira Da Costa 2015-09-03 09:36:14 UTC
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
Comment 12 Hugo Pereira Da Costa 2015-09-03 09:43:55 UTC
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
Comment 13 Hugo Pereira Da Costa 2015-09-03 09:43:56 UTC
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
Comment 14 Hugo Pereira Da Costa 2015-09-03 09:45:12 UTC
Closing this bug report.
This is the best we can do (workaround), until the actual bug in Qt is fixed.