PDA

View Full Version : CE_MenuEmptyArea problem drawing



Apocalypse
12th September 2010, 21:45
How can I draw CE_MenuEmptyArea?


QPainter painter(this);
QStyleOptionMenuItem option;
option.initFrom(this);
option.rect=(0,0,100,100);
option.menuRect(0,0,100,100);
option.menuItemType=QStyleOptionMenuItem::EmptyAre a;
style()->drawControl(QStyle::CE_MenuEmptyArea, &option, &painter, this);

I ran this code with different styles with no success.
And there is often "break;" in cases of CE_MenuEmptyArea in different styles' sources.
May it be incorrect way to draw plain menu area?

Lykurg
12th September 2010, 21:51
You find a break since normal style won't draw anything in an empty area of the menu bar. You are looking for QStyle::PE_PanelMenuBar with QStyle::drawPrimitive(), I guess.

Apocalypse
12th September 2010, 21:55
No, The problem that I'm looking for menu empty area, not menubar one.
But I wouldn't be suprised if styles can't draw such things directly

Lykurg
12th September 2010, 22:14
Sorry, I misunderstood you. After a quick research I am also confused. I bet you are right and CE_MenuEmptyArea is simply left empty that the normal background of the menu panel is used.

Apocalypse
12th September 2010, 22:26
And how is menu drawn? Item by Item? But I also couldn't get any plain menu item to draw