how to capture a mouse leave event only on a specific QWidget ( a QlineEdit ) ?
-
i want to capture a mouse leave event only on a specific QWidget ( a QlineEdit ). one way to do is to inherit from that class and over ride the virtual function , but i cant do that since i'm using QtDesigner
-
@Lemat
I don't know about/use Qt Designer. Can you useeventFilter()
(https://doc.qt.io/qt-5/qobject.html#eventFilter) instead? -
Hi,
The procedure is exactly what you expected. Subclass QLineEdit. Then, on QtDesigner, place a standard QLineEdit. Right-click on it. You will see an item "Promote to". Select it. A window will be displayed to choose the class. As none is present, you will have to give it the name of your class, and the location of the .h file (or click on "global" if the project has the access path). -
Hi
As @Alain38-0 talks about. You can still use your own subclass with Designer.
That feature is called Promotion
https://doc.qt.io/qt-5/designer-using-custom-widgets.html -
Okay, thanks for all. i used
eventFilter();
and it work!!!.
-
@Alain38-0 okay, i will use it for another project. thanks.
3/6