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. QComboBox: issue when used with eventFilter
Forum Updated to NodeBB v4.3 + New Features

QComboBox: issue when used with eventFilter

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    demanciel
    wrote on last edited by
    #1

    I need to implement a QComboBox like widget that, when open, displays a list of checkable items. I would like the user to be able to check/uncheck more than one item before the QComboBox closes. I'm working with Qt 5.4.

    To that end, I subclassed QComboBox reimplementing eventFilter() that is attached to the QComboBox's view and to its viewport. This eventFilter() method aims at intercepting MousButtonRelease and FocusOut events so that hidePopup() is not invoked on MouseButtonRelease but rather on FocusOut event.

    This does not work. Actually, the eventFilter does not receive any event after showPopup is called and before hidePopup is except one: A FocusAboutToChange event which is received right after showPopup, when the QComboBoxListView is displayed.

    What is happening? What did I do wrong? I had a look at the QComboBox code and it also installs an eventFilter on both the view and its view port, intercepting the same events. As far as I saw, I install my eventFilter after QComboBox's. The doc says that mine should be called first.
    Is there a better way to do this?

    I also read a few posts on QComboBox, "this one":http://qt-project.org/faq/answer/how_can_i_make_a_qcombobox_have_multiple_selection for instance. But this did not help for the purpose...

    Thanks a lot!

    D'manciel 125 Cl 192

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You might be interested by "QxtCheckComboBox":http://libqxt.bitbucket.org/doc/0.6/qxtcheckcombobox.html

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        demanciel
        wrote on last edited by
        #3

        Hello,

        Thanks a lot. I'll have a look.

        D'manciel 125 Cl 192

        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