Important: Please read the Qt Code of Conduct -

QComboBox popup menu

  • Curious, has anyone ever created their own ComboBox class inherited from QComboBox where you can emit a signal when the popmenu has been clicked and, of course, emit a signal once it is closed? It's just when the popup menu is clicked, the main ComboBox loses focus. I'm trying to capture the event of the popup, but I've never really worked with Event Filtering in QT. Any help would be most appreciated.

  • No need for event filtering just reimplement showPopup and hidePopup

    #ifndef TESTCOMBO_H
    #define TESTCOMBO_H
    #include <QComboBox>
    class TestCombo : public QComboBox
        TestCombo(QWidget* parent=nullptr):QComboBox(parent){}
        virtual ~TestCombo()=default;
        virtual void hidePopup() override{
            emit menuHidden();
        virtual void showPopup() override{
            emit menuPopped();
        void menuPopped();
        void menuHidden();
    #endif // TESTCOMBO_H

  • @VRonin Thank you so much! This is exactly what I was looking for. I appreciate your help!

Log in to reply