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. How can we know when mouse cursor enter a widget from other different widget class?
QtWS25 Last Chance

How can we know when mouse cursor enter a widget from other different widget class?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 6.2k Views
  • 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    Suppose i have a slider class and button class and both are under same parent. I want to know inside slider class function when mouse enter the button.

    Pratik Agrawal

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Have a look at "this thread":http://developer.qt.nokia.com/forums/viewthread/1376 for a similar question with solution.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pratik041
        wrote on last edited by
        #3

        No actually that thread is little bit different. Because here i want to know inside the slider class the position of the mouse pointer when it enter the button.

        Pratik Agrawal

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          which button?
          A slider does not contain a button, it contains a so called sub control, which is in fact not a widget, it's just a logical thing that is drawn :-)

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pratik041
            wrote on last edited by
            #5

            I am not talking about any specific button or slider. I want to know in general if we have two widget or two logical area and both are under same parent. How can we know inside one widget class function when mouse enter the other widget area or logical area.

            Pratik Agrawal

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rahul Das
              wrote on last edited by
              #6

              You want to do something with slider, when mouse is over button. Right ?
              If it is so, you could try overriding the following in QPushButton.
              @void QWidget::enterEvent ( QEvent * event )@

              EDIT : you can make sure, that the widget is under the mouse cursor using : "QWidget::underMouse ()":http://doc.qt.nokia.com/stable/qwidget.html#underMouse


              Declaration of (Platform) independence.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pratik041
                wrote on last edited by
                #7

                my problem is while implementing enter event the enter event will be called only for that widget which class we are implementing ex - customclass::enterEvent(QEvent *e); here the enter event will be called only when mouse enter custom class area but i want to detect the enterEvent of other widget from custom class.

                Pratik Agrawal

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  goetz
                  wrote on last edited by
                  #8

                  You can try to use an "eventFilter":http://doc.qt.nokia.com/4.7/qobject.html#eventFilter

                  http://www.catb.org/~esr/faqs/smart-questions.html

                  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