[Qt-interest] Can I raise 2 toolbar icons at the same time?

Bob Babcock wssddc at nospam.gis.net
Thu May 27 02:59:39 CEST 2010


Andre Somers <andre at familiesomers.nl> wrote in
news:4BFCAE5D.6020708 at familiesomers.nl: 

> Op 26-5-2010 6:46, Bob Babcock schreef:
>> I would like to have a pair of toolbar buttons with the following
>> properties:
>>
>> 1. The first button triggers a simple action, say print.
>> 2. The second button pulls down a menu of related actions, say print
>> preview, page setup,...
>> 3. When the mouse cursor is over either button, both icons raise up.
>> 4. When both icons are raised, a vertical divider line makes it clear
>> that there are two buttons.
>>
>> It's number 3 (and maybe 4) that I don't know how to do.  Any
>> suggestions? An example of this in a non-Qt program is the print icon
>> in Internet Explorer 8.
>>    
> Just to be clear: you are aware of 
> QToolButton::setPopupMode(QToolButton::MenuButtonPopup) and 
> QToolButton::setMenu?
> 
> André

Yes.  The only problem is getting the visual effect of both icons raising 
up at the same time to indicate that they control related functions.  
Assuming I can get them both raised up, I might have to do something like 
putting a narrow separator between them to finish the effect.

I assume I could do this by tracking mouse entry/exit and manually 
raising/lowering the buttons.  Is there an easier way?



More information about the Qt-interest-old mailing list