[Qt-interest] Porting Qt 3 to Qt 4
Andre Somers
andre at familiesomers.nl
Thu Sep 2 21:27:45 CEST 2010
Op 2-9-2010 19:21, Jake Colman schreef:
> The reason I am using a QCustomMenuItem is because a checked menu item
> in Motif (at least in our configuration) is supposed to be displayed
> with a box that is red when checked and cleared when not. Qt's
> implementation, at least in Qt3, displayed a check instead of this box.
> So I extended QPopupMenu with a insertMotifCheckItem() method to create
> this custom menu item that knows how to paint itself accordingly.
>
> Having explained all this, is there a better/different way to do this in
> Qt4? Please remember that I am trying to change as little code as
> possible (at least for now) as part of this port.
Perhaps the easiest way to do this is to use a widget style sheet. You
can customize the appearance of a menu or menu item using a widget style
sheet. Drawing a red square instead of a checkmark should be easy. You
can style the check mark using the ::indicator subcontrol. Though... one
wonders what drives a person in this day and age to use a Motif style ;-)
André
More information about the Qt-interest-old
mailing list