Getting MouseEvent for a QDoubleSpinBox
-
Hello team,
I have a QLineEdit followed by a QDoubleSPinBox widget, i need to intercept mouse pressure in both widgets.
I implemented an eventFilter in QApplication class, and i have installed it in the QLineEdit widget And QDoubleSpinBox widget.
When i click in QLineEdit it works fine, and works fine also if i click in the button section of QDOubleSpinBox, but if i click in the lineedit section of the double spin box, nothing happens.
How can intercept the mouse event when i click also in lineedit section of the spinbox?? I wanted to install the eventfilter on the lineedit with myDoubleSpinBox.lineEdit.installEventFilter(myEnetFilter), but it s protected and i can't. What can i do?
Kind Regards
emazed -
Hello team,
I have a QLineEdit followed by a QDoubleSPinBox widget, i need to intercept mouse pressure in both widgets.
I implemented an eventFilter in QApplication class, and i have installed it in the QLineEdit widget And QDoubleSpinBox widget.
When i click in QLineEdit it works fine, and works fine also if i click in the button section of QDOubleSpinBox, but if i click in the lineedit section of the double spin box, nothing happens.
How can intercept the mouse event when i click also in lineedit section of the spinbox?? I wanted to install the eventfilter on the lineedit with myDoubleSpinBox.lineEdit.installEventFilter(myEnetFilter), but it s protected and i can't. What can i do?
Kind Regards
emazed@emazed said in Getting MouseEvent for a QDoubleSpinBox:
myDoubleSpinBox.lineEdit.installEventFilter(myEnetFilter), but it s protected and i can't. What can i do?
You need to subclass
QDoubleSpinBoxand use that, so that you can access itsprotectedmethods (lineEdit()).If you really don't want to do that you can use
myDoubleSpinBox.findChild<QLineEdit *>()to get theQLineEdit *. -
@emazed said in Getting MouseEvent for a QDoubleSpinBox:
myDoubleSpinBox.lineEdit.installEventFilter(myEnetFilter), but it s protected and i can't. What can i do?
You need to subclass
QDoubleSpinBoxand use that, so that you can access itsprotectedmethods (lineEdit()).If you really don't want to do that you can use
myDoubleSpinBox.findChild<QLineEdit *>()to get theQLineEdit *.