Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    [Solved]QToolButton Hover event

    General and Desktop
    2
    5
    7498
    Loading More Posts
    • 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
      Sorin last edited by

      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 Reply Quote 0
      • D
        DenisKormalev last edited by

        Maybe :hover pseudo state will help you?

        1 Reply Last reply Reply Quote 0
        • S
          Sorin last edited by

          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 Reply Quote 0
          • D
            DenisKormalev last edited by

            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 Reply Quote 0
            • S
              Sorin last edited by

              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 Reply Quote 0
              • First post
                Last post