Results 1 to 2 of 2

Thread: Capture QLineEdit mousePressevent for controls in a .ui file

  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11
    Thanks
    1

    Unhappy Capture QLineEdit mousePressevent for controls in a .ui file

    My application uses .ui files for it's controls. However, I'd like to capture the mousePressEvent for a QLineEdit that's in the UI file. What is the sane way to do this?
    So far it seams I need to subclass the QLineEdit, but this means I can't add it to the .UI file anymore (AFAIK).
    Working on KMess, a MSN Messenger client for Linux/KDE.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Capture QLineEdit mousePressevent for controls in a .ui file

    You can install an event filter on the line edit widget and therefore you don't have to subclass it. Another way is to subclass and then use the "promote to a custom widget" option in the designer. The option can be found in the line edit's context menu.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    vdboor (5th June 2006)

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.