Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, January 2008
Help with drawing items in a model view

Pages: Prev | 1 | 2 | Next

Message 16 in thread

Thanks for help...

I already implemented the ContextMenuEvent.

1. But the Combo Box should appear only on selecting some particular item
in the PopUp Menu.

2.How to close the combo box after selecting an item?


Cheers


> rohitj@xxxxxxxxxxxxxx wrote:
>> Thanks for reply
>>
>> BUt the menu is a pop up menu which appears on right clicking the muse
>> button. I can not attach it with Tool Bar.
>>
> If you just want to pop out a combo box, that's fine.
> void YourClass::contextMenuEvent(QContextMenuEvent *event)
> {
>     //contextMenu->exec(event->globalPos());
>     combo->move(event->globalPos());
>     combo->show();
> }
> But anyway, the menu or sub menu cannot have a combo box widget as its
> item.
> Lingfa
>


--
 [ signature omitted ] 

Message 17 in thread

On Fri January 25 2008 18:14, rohitj@xxxxxxxxxxxxxx wrote:
> 1. But the Combo Box should appear only on selecting some particular item
> in the PopUp Menu.
It's already answered in my other post, I think :)...

> 2.How to close the combo box after selecting an item?
When an item has been selected, that's easy, because you could use the emitted 
activated() signal and close() the combo-box in a connected slot.

http://doc.trolltech.com/4.3/qcombobox.html#activated

The question is when to close the combo-box if NO item is selected. I'd use 
the focusOutEvent().

http://doc.trolltech.com/4.3/qwidget.html#focusOutEvent

HTH, René
-- 
 [ signature omitted ]