How to get Mouse Click event on QComboBox



  • I want to know , when the QComboBox has been clicked by mouse other than using pos() or GlobalPos() function.

    i used the following code to do, but nothing is positive...
    @
    // with this function , i am not able to get the combobox click event
    void TestDlg::mousePressEvent(QMouseEvent *aE)
    {
    qDebug() << ": btn" << aE->button() <<aE->type()
    << "btns" << aE->buttons()
    << "mods" << aE->modifiers()
    << "gpos" << aE->globalPos() << "pos" << aE->pos();
    //QComboBox::mousePressEvent(aE);

    }
    @



  • TestDlg is a QComboBox subclass? Can you paste its definition?



  • No..... TestDlg is QDialog Subclass.
    I used QComboBox as one of the control in TestDlg window



  • Well... it seems obvious to me that the events that happen for the combobox will be send to... the combobox. Not the form the combobox is on.

    You could install an event filter on the combobox if you want to catch its events though.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.