How to get mouse events(mouse release) on a pushbutton
How can i get mouse press & mouse release events on a qpush button.
I can get mouse press event of a button by writing its slot. How can i get the mouse release event?? pls help
My purpose is to provide a new cursor image to the cursor when a button is clicked.
I have done it using its slot and restored back the default icon using a timer.
the problem is when i press the mouse button for a long time without release the image will restore on the time out of timer.
I tryed mouse press & mouse release event but it doesnot works for the pushbuttons but works on frames.
Re: How to get mouse events(mouse release) on a pushbutton
QAbstractButton::pressed() and QAbstractButton::release() signals.
Code:
connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(pressed()));
connect(ui->pushButton, SIGNAL(released()), this, SLOT(released()));
have slots ...
Code:
void MainWindow::pressed(){
qDebug()<<"hi pressed";
}
void MainWindow::released(){
qDebug()<<"hi released";
}
Re: How to get mouse events(mouse release) on a pushbutton
k fine.
It works... is mouse events can be used
Re: How to get mouse events(mouse release) on a pushbutton
Did you try to use an event filter for those purposes?
Link