QMenu and setChceckable Spacing and Text alignment
-
In Qt 5.12, using a checkable Action in a QMenu would insert a tick in the blank space to the left of the menu Item.
In Qt 5.15, there was bug that resulted in checkable Menu items being offset with additional spacing for the check, which made them appear unaligned, relative to other non-chackable menu items.
In Qt 6.5, checkable Menu items now appear aligned again, however the entire Menu is now further intended to the right. So there is extra unused space for most of the menu Items, and checkable items appear with a check, and then a space, and then the text for the menu item.
Is it possible to have All Menu items have their text be aligned, but still only have the single icons worth of space be used? If so how?I've added an image showing the Menu with a single check item, that also has the extra space after the Checked item ( that i want to remove ), and the other menu items have double spacing next to them.
Cheers,
James -
I can't seem to repro it in a simple example :(
I am using a custom icon / png to indicate the checked state of the menu Item,
that is a difference from the basic example i constructed.If anyone has a guess as to why my menu's are not behaving in the expected manner i'd love to hear it!
-
OK I've solved it.
The entire application has a Stylesheet applied, including settings for a QMenu, and QMenu item, with custom padding.
By overriding the padding for the specific Menu in question I am setting the left padding to be the check icon size smaller than the normal padding size.
Now when the menu is draw it is consistent in padding size with all other menu's.I still dont think i should have to do it this way, but it's working.
-