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. Button hovering
Qt 6.11 is out! See what's new in the release blog

Button hovering

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Ducky
    wrote on last edited by
    #1

    HI all,

    I was following "Video tutorial ":https://www.youtube.com/watch?v=d0CDMtfefB4 on "Qt mouce events on a qlabel".
    It was great when i hovered over one label the color changed on another label.

    and that got me thinking if i can do the same with a button and yes i can.

    Thar are Tree things i don't like about this approach.

    1. it take a lot of code to handle the mouse events this is not very handy if you got a lot of buttons.(like me)
    2. it destroy all the default click events.
    3. you need a extra label to change the color of.

    so is their a better way of handling a button hover.

    for example.

    there is a default Click

    @void Dialog::on_pushButton_clicked()@

    is there also a default Hover like below.

    @void Dialog::on_pushButton_hover()@

    Or is there some other way of detecting a hover on a button.

    Thanx in advanced for the info.

    Bart

    Well I used to write code in Autoit and work on Windows.
    And now i am trying to write code in QT and work on Ubuntu

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msue
      wrote on last edited by
      #2

      There are virtual protected functions:
      void QWidget::enterEvent ( QEvent * event )
      void QWidget::leaveEvent ( QEvent * event )
      you can use

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Ducky
        wrote on last edited by
        #3

        ideed that wil work.
        i still have to put in a lot of code but it keeps the default mouse click events.

        I am stil finding it a little disappointing that is not included as a default event for a button

        but yes i will get is to work.

        Thanx msue

        Well I used to write code in Autoit and work on Windows.
        And now i am trying to write code in QT and work on Ubuntu

        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