Results 1 to 6 of 6

Thread: QComboBox drop list button events

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox drop list button events

    Sorry to take so long to respond. I killed my laptop and had to rebuild.

    I tried mchara's suggestion of overriding mousePressEvent() then underMouse() idea in a QComboBox derived class. It didn't work and the behavior was unexpected. When the popup list is not visible the mousePressEvent() reaches my class. When the popup list is visible the mousePressEvent() does _not_ reach my class. That's the case I want to handle.

  2. #2
    Join Date
    Jul 2007
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox drop list button events

    The button on the combo box that shows or hides the list is known in the Qt source as the Arrow. I don't see how it is possible to override the handling of the arrow being clicked when the popup is visible. When the list is visible the QComboBox isn't the active widget. It's something called a QComboBoxPrivate that doesn't appear to be a child of the QComboBox. The mouse event you'd have to handle goes to the QComboBoxPrivate.

  3. #3
    Join Date
    Jul 2007
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox drop list button events

    No-one noticed that a read only combobox with the list automatically appearing immediately when the widget shows is pretty much a listbox. When I started with this project I used a listbox but found that implementing updateEditorGeometry() was a pain for a listbox delegate. For a combobox you only need to calculate the geometry for the line edit portion (you already have the gemometry for the table cell) and the widget calculates the geometry for the list automatically. I think I'll go back to looking at a listbox.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.