[Qt-interest] How to handle mouse click event of QComboBox

Ferenc Stelcz ferenc at stelcz.hu
Mon Jun 22 12:20:29 CEST 2009


Manish Chaturvedi wrote:
> I cannot see my previous query, so sending it again.
> 
> Hi All,
> 
> I am having a Dialog box with few combo box on it. I want to call slot  comoboxClicked() on the click event of QComboBox. This is to fetch the content for combo box whenever it is clicked, but I don't see any click()  signal for QComboBox. There are only 4 signals available for QComboBox i.e. activated(), currentIndexChanged(), editTextChanged(), and highlighted(), where all of them does not seems to solve my purpose.
> 
> Is it possible to call our slots on the click() event of QComboBox? If yes then please let me know how to make this work.
> 
> Thanks  in advance!
> Manish
> 
> 
Hi!

Strictly IMHO: You can emulate the clicked signal with the activated(int 
index) signal. As the documentation states:

"This signal is sent when the user chooses an item in the combobox. The item's 
index is passed. Note that this signal is sent even when the choice is not 
changed. If you need to know when the choice actually changes, use signal 
currentIndexChanged()."

So user points on the combobox, it pulls down, user clicks on an item (or 
selects one with the keyboard) and as the combo closes-up the activated signal 
gets emitted, holding the currently selected item's index. Isn't this what you 
would like to achieve?

HTH

--
Ferenc Stelcz
Junior Software Engineer

Banyan Technologies LLC.


__________ Information from ESET Smart Security, version of virus signature database 4177 (20090622) __________

The message was checked by ESET Smart Security.

http://www.eset.com





More information about the Qt-interest-old mailing list