[Qt-interest] Porting Qt 3 to Qt 4
Jake Colman
colman at ppllc.com
Fri Sep 17 00:06:54 CEST 2010
>>>>> "AS" == Andre Somers <andre at familiesomers.nl> writes:
AS> 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.
AS> Perhaps the easiest way to do this is to use a widget style
AS> sheet. You can customize the appearance of a menu or menu item
AS> using a widget style sheet. Drawing a red square instead of a
AS> checkmark should be easy. You can style the check mark using the
AS> ::indicator subcontrol. Though... one wonders what drives a
AS> person in this day and age to use a Motif style ;-)
Andre,
I am finally getting back to this part of my application. I'm having
trouble understanding the QAction-based paradigm and how it compared to
the insertItem-based paradigm in Qt3. For example, menu items no longer
have an ID and findMenu() is no longer defined. So how does one look up
a menu item? Is it no longer needed?
As far as my original question is concerned, can you please give me some
more detail on how I can use the widget style sheet to achieve my
desired result? I want to provide an API that allows the coder to
insert a menu item that would display the red square instead of a
checkmark. The coder would also have to be able to find that item later
in order to check/uncheck it - or am I missing the paradigm here?
I'd appreciate any pointers - even if it is just a list of what docs
need to be read.
TIA!
...Jake
--
Jake Colman | Director, Software Development
Principia Partners LLC
101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770
t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929
e: colman at ppllc.com | w: www.principiapartners.com
Credit technology innovation awards winner 2008 and 2009
More information about the Qt-interest-old
mailing list