PDA

View Full Version : Menu issue



JustinTerpstra
27th January 2011, 21:06
We want to use a std look and feel application but on a touchscreen. I need to enlarge the menu items to be a minimum of 40x80 for easy selection.

I have been working with the stylesheets, but I can't seem to get what I want. I have a QMenuBar with a bunch of QActions (who have child actions) added to it. The stylesheets affect the first row of the menu, but nothing on the submenus. Ideally the action/action selection needs to be enlarged (not the text itself).

Via QMenuBar I can set a min-width and min-height, and it works perfect.

Via QMenu I can modify all submenus to have a large font, but the min-width and min-height affect the overall menu size itself, not the items in the menu.

From there I am trying the QMenu::item, but it doesn't seem to be controlling anything....

QMenu::item{ min-height: 40px; }

What am I doing wrong ... ?????

wysota
29th January 2011, 13:08
Put this in your main right after you create the application object:

app.setGlobalStrut(QSize(40,40)),
This will inform Qt you don't want any user-clickable item to be smaller than 40x40. You won't have to manipulate the sizes on the widget level then. All GUI elements should respect this setting.You should make your custom ones obey it as well, by the way.