Following your good advice, I set up an event filter that works. I was just wondering whether there is a better way than what I implemented.
For each Widget that I want to react to QEvent::Enter or QEvent::Leave I added :
anyWidget->installEventFilter( this );
anyWidget->installEventFilter( this );
To copy to clipboard, switch view to plain text mode
Then as filter :
bool ApplicationWindow
::eventFilter(QObject *target,
QEvent *event
) {
if (event
->type
() == QEvent::Enter) if (event
->type
() == QEvent::Leave )
}
bool ApplicationWindow::eventFilter(QObject *target, QEvent *event)
{
if (event->type() == QEvent::Enter)
QApplication::setOverrideCursor( QCursor(Qt::PointingHandCursor) );
if (event->type() == QEvent::Leave )
QApplication::restoreOverrideCursor();
return QMainWindow::eventFilter(target, event);
}
To copy to clipboard, switch view to plain text mode
Is this the right way to do it ?
Bookmarks