Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Getting MouseEvent for a QDoubleSpinBox
Forum Updated to NodeBB v4.3 + New Features

Getting MouseEvent for a QDoubleSpinBox

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 264 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    emazed
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • E 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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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 QDoubleSpinBox and use that, so that you can access its protected methods (lineEdit()).

      If you really don't want to do that you can use myDoubleSpinBox.findChild<QLineEdit *>() to get the QLineEdit *.

      E 1 Reply Last reply
      1
      • JonBJ JonB

        @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 QDoubleSpinBox and use that, so that you can access its protected methods (lineEdit()).

        If you really don't want to do that you can use myDoubleSpinBox.findChild<QLineEdit *>() to get the QLineEdit *.

        E Offline
        E Offline
        emazed
        wrote on last edited by
        #3

        @JonB i tried findchild, and worked, thanks mate!!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved