alenn.masic
23rd September 2012, 22:57
Hi all
I need to change cursor when my mouse cursor is over rectangle. I tried using eventFilter but my app crash when I try to run it, can you help me with this:
bool MainWindow::eventFilter(QObject *o, QEvent *e){
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>( e );
QPoint pos = mouseEvent->pos();
if(rect.contains(mouseEvent->pos())){
cursor.setShape(Qt::SizeFDiagCursor);}
else{
cursor.setShape(Qt::ArrowCursor);}
setCursor(cursor);
return QMainWindow::eventFilter(o, e);}
I need to change cursor when my mouse cursor is over rectangle. I tried using eventFilter but my app crash when I try to run it, can you help me with this:
bool MainWindow::eventFilter(QObject *o, QEvent *e){
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>( e );
QPoint pos = mouseEvent->pos();
if(rect.contains(mouseEvent->pos())){
cursor.setShape(Qt::SizeFDiagCursor);}
else{
cursor.setShape(Qt::ArrowCursor);}
setCursor(cursor);
return QMainWindow::eventFilter(o, e);}