PDA

View Full Version : Capture QLineEdit mousePressevent for controls in a .ui file



vdboor
4th June 2006, 13:10
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). :(

jpn
4th June 2006, 13:14
You can install an event filter (http://doc.trolltech.com/4.1/qobject.html#installEventFilter) 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.