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. [Solved]QToolButton Hover event
QtWS25 Last Chance

[Solved]QToolButton Hover event

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 8.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.
  • S Offline
    S Offline
    Sorin
    wrote on last edited by
    #1

    I'm trying to set a background-color on a QToolButton when hovering another one. Do you know if I can use a hover event or something related to the "hover event" behavior?
    Thanks!

    There are only 10 types of people in the world: Those who understand binary, and those who don't

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Maybe :hover pseudo state will help you?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sorin
        wrote on last edited by
        #3

        Don't now if it works with pseudo states, how can I refer to the second QToolButton from the first button's stylesheet?

        @button1->setStylesheet(" QToolButton:hover{\n"
        " can I change background of another button?}"); @

        There are only 10 types of people in the world: Those who understand binary, and those who don't

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          No you can't do it. You can set global app stylesheet or stylesheet on widget containing these buttons with using ids in scopes (id is equal to objectName).

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sorin
            wrote on last edited by
            #5

            Did it old style : on enterEvent( leaveEvent ) for those two buttons emited signals( StartHover and EndHover ) to parent widget were I added some slots that catch those signals and set the styleSheet accordingly

            There are only 10 types of people in the world: Those who understand binary, and those who don't

            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