Help with QMenu item stylesheet
I can't figure this out, if I apply a stylesheet to QMenu, the spacing between the menu text, and the hotkey text does not expand to adjust for the text length, but if I use the default system menu, it works as expected.
Picture of my problem:
http://img60.imageshack.us/img60/9466/qmenu.jpg
You can see above that there is not enough space between the text, and it does not seem to expand at all. Any help would be appreciated!
CSS Code:
Code:
background-color: white;
}
padding: 2px 20px 2px 20px;
border: 1px solid transparent; /* reserve space for selection border */
spacing: 20px;
}
border-color: darkblue;
background: rgb(53, 120, 191, 150);
color:white;
}
height: 2px;
margin: 2px 5px 2px 4px;
}
width: 20px;
height: 13px;
}
Re: Help with QMenu item stylesheet
Might be prob with padding...
what if u remove the padding line ?
Re: Help with QMenu item stylesheet
Removing padding makes the menu itself smaller, but the space between the text remains the same for some reason.
Re: Help with QMenu item stylesheet
So if the menu looks good without you stylesheet I would incrementally add the styles.
Starting only with the white background for QMenu. Compile and check.
The add a border for QMenu::item. Compile and check again.
And so on...
It takes some time to find the error.
Re: Help with QMenu item stylesheet
Causes by the border attribute. Seems to be a bug. So check the task tracker and if no report can be found, minimize your style sheet and sing up an bag report.
Re: Help with QMenu item stylesheet
Quote:
Originally Posted by
Lykurg
Causes by the border attribute. Seems to be a bug. So check the task tracker and if no report can be found, minimize your style sheet and sing up an bag report.
I minimized my stylesheet, and it seems that if I remove QMenu::item from my stylesheet, then I get the correct space between the item text and shortcut text, but I loose the padding on the sides and that means things like checkmarks on the menu end up inside the text (ugly solution.)
If I add QMenu::item, and omit padding, then the whole menu shrinks down, and I also loose the space between the text. If I add padding, it looks ok but I still do not get the normal space between the text in the menu no matter what I try.
I guess this is either some sort of bug, or I am missing something in QMenu::item? :confused:
Also, the border attribute by itself has no effect on the spacing between the text, since I can remove it and still have the same problem.
Re: Help with QMenu item stylesheet
Anyone have an idea on how to fix this?
Re: Help with QMenu item stylesheet
maybe I missed something, but add min-width in css for QMenu::item.
Re: Help with QMenu item stylesheet
Quote:
Originally Posted by
spirit
add min-width in css for QMenu::item
That is not really satisfying and not very independent if you don't know the entries and the font size of the menu.
The strange behavior is that setting (only) a css border attribute in QMenu::item has effect on the size hint what should not be.
Re: Help with QMenu item stylesheet
Quote:
Originally Posted by
Lykurg
That is not really satisfying and not very independent if you don't know the entries and the font size of the menu.
The strange behavior is that setting (only) a css border attribute in QMenu::item has effect on the size hint what should not be.
but it works :)
Re: Help with QMenu item stylesheet
Quote:
Originally Posted by
spirit
maybe I missed something, but add min-width in css for QMenu::item.
Not the most elegant solution but it works! Thanks!
Re: Help with QMenu item stylesheet
Quote:
Originally Posted by
Sufu
Not the most elegant solution but it works! Thanks!
Have you send a report to Qt? Because this should be fixed...