Button hovering
-
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.
- 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)
- it destroy all the default click events.
- 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
-
There are virtual protected functions:
void QWidget::enterEvent ( QEvent * event )
void QWidget::leaveEvent ( QEvent * event )
you can use -
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