Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to get Mouse Click event on QComboBox
Forum Update on Monday, May 27th 2025

How to get Mouse Click event on QComboBox

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 7.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M_31
    wrote on last edited by
    #1

    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);

    }
    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

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

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M_31
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved