Open Object Dialog Qt4 Port and Enhancements: Post-Development Review Two (1-24-2013)
The "Windows 7" desktop theme's menu style does not look good in a custom menu implemented to replace a combo box's drop-down menu. Even with all QActions set for "not checkable" and without icons, there is an approximately 30-pixel left-side margin. We haven't been able to get rid of it entirely, but we can reduce it to, what looks to be, the "Windows Classic" theme's menu style, having only an 18-pixel left side margin.
The bottom image result is accomplished as follows. However, technically, this seems to have the effect of just defeating the style specialization which is responsible for that extra-wide left margin, rather than actually controlling that margin's width (which the code is intended to do).
void OpenObjectDlg::OrderCombo::build() { ... ... ... ... ... ... // *************************************************** // *** Menu Style: Left Margin/Indent Not Wanted *** // *************************************************** // Note [Phil, RW 6.3, Qt 4.8.3, 1-24-2013]: Applying this menu // style ("QMenu::indicator { width: 0px; }") to the menu and // submenu DOES improve their "Windows 7" style appearance -- // reducing the width of the checkbox/icon area on the left side // of the menu -- i.e. making it appear more like the "Windows // Classic" menu. But changing that width attribute doesn't // actually have an effect (e.g. to 100 pixels). And applying // just ("QMenu::indicator { }") has the same effect. So, I // don't know exactly how this is having an effect. static const QString menuStyle ( "QMenu::indicator { width: 0px; }" ); _menu->setStyleSheet (menuStyle); _setMenu->setStyleSheet (menuStyle); } |
--- (end) ---