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 to capture a mouse leave event only on a specific QWidget ( a QlineEdit ) ?

how to capture a mouse leave event only on a specific QWidget ( a QlineEdit ) ?

Scheduled Pinned Locked Moved Solved General and Desktop
qmouseeventqlineedit
6 Posts 4 Posters 1.5k 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.
  • LematL Offline
    LematL Offline
    Lemat
    wrote on last edited by aha_1980
    #1

    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

    Time to elevate.

    JonBJ 1 Reply Last reply
    0
    • LematL Lemat

      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

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

      @Lemat
      I don't know about/use Qt Designer. Can you use eventFilter() (https://doc.qt.io/qt-5/qobject.html#eventFilter) instead?

      1 Reply Last reply
      7
      • A Offline
        A Offline
        Alain38 0
        wrote on last edited by
        #3

        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).

        LematL 1 Reply Last reply
        5
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          1
          • LematL Offline
            LematL Offline
            Lemat
            wrote on last edited by Lemat
            #5

            Okay, thanks for all. i used

            eventFilter();
            

            and it work!!!.

            Time to elevate.

            1 Reply Last reply
            1
            • A Alain38 0

              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).

              LematL Offline
              LematL Offline
              Lemat
              wrote on last edited by
              #6

              @Alain38-0 okay, i will use it for another project. thanks.

              Time to elevate.

              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