Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. changing the text of push button on hover

changing the text of push button on hover

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 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.
  • P Offline
    P Offline
    Prabhav
    wrote on last edited by
    #1

    Hi

    As far as i know, to change UI of pushbutton on hover, we have to change the style sheet. But using that, i cant change the text of the button on hover. Is there any way to do that?

    JonBJ 1 Reply Last reply
    0
    • P Prabhav

      Hi

      As far as i know, to change UI of pushbutton on hover, we have to change the style sheet. But using that, i cant change the text of the button on hover. Is there any way to do that?

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

      @Prabhav
      No, you cannot change text via stylesheet. If you want to do that you will need to deal with the hover event in code.

      P 1 Reply Last reply
      0
      • JonBJ JonB

        @Prabhav
        No, you cannot change text via stylesheet. If you want to do that you will need to deal with the hover event in code.

        P Offline
        P Offline
        Prabhav
        wrote on last edited by
        #3

        @JonB How to do it via code?

        JonBJ 1 Reply Last reply
        0
        • P Prabhav

          @JonB How to do it via code?

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

          @Prabhav
          Simply by Googling QPushButton hover event. One of my answers on this forum is at https://forum.qt.io/topic/123237/pyside6-funtion-on-enterevent-or-hovering-on-child-widget/3. Either subclass and do your work in enterEvent() or use eventFilter() if you don't want to subclass. Set the button's text there to whatever desired. And unset on leaveEvent().

          1 Reply Last reply
          1

          • Login

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