Hi everyone.
Firstly sorry for my english.

I have some problem with qt so i decidied to ask You for help.

I'writting a program. I want to do somethink like this:
- when i move mouse on button, for example, should show table with data like name.
The main difficult to me is that the button is on MainWindow and if i want to show new table when the mouse is on button i must create new class or somethink like this.

I rode a lot about QMouseEvent and event filter but i stuck i don't know what i should do next.

1. Firts way i used event filter. Some code:.cpp
Qt Code:
  1. bool MainWindow::eventFilter(QObject *object, QEvent *ev)
  2. {
  3. if (object == pushButton)
  4. {
  5. if(ev->type() == QEvent::Enter)
  6. {
  7. QApplication::setOverrideCursor( QCursor(Qt::CrossCursor) );
  8. return true;
  9. }
  10. else
  11. {
  12. return false;
  13. }
  14. }
  15. else
  16. {
  17. QApplication::restoreOverrideCursor();
  18. return false;
  19. }
  20. }
  21. ...
  22. ...
  23. MainWindow::MainWindow(QWidget *parent) :
  24. QMainWindow(parent),
  25. ui(new Ui::MainWindow)
  26. {
  27. ui->setupUi(this);
  28. pushButton->installEventFilter(this);
  29. }
To copy to clipboard, switch view to plain text mode 
I set a type of cursor because i wanted to see it is working.
.h
Qt Code:
  1. ...
  2. protected:
  3. bool eventFilter(QObject *object, QEvent *ev);
  4. ...
To copy to clipboard, switch view to plain text mode 
This method isn't working. When I press Run button the application crash.

2.The second way is use EnterEvent and LeaveEvent. For that i create a new .h file and called him FlatButton when i declared:
.h
Qt Code:
  1. ...
  2. protected:
  3. void enterEvent(QEvent *ev);
  4. void leaveEvent(QEvent *ev);
  5. ...
To copy to clipboard, switch view to plain text mode 
In cpp file:
Qt Code:
  1. ...
  2. void FlatButton::enterEvent(QEvent *ev)
  3. {
  4. QApplication::setOverrideCursor( QCursor(Qt::CrossCursor) );
  5. }
  6. void FlatButton::leaveEvent(QEvent *ev)
  7. {
  8. QApplication::restoreOverrideCursor();
  9. }
  10. ...
To copy to clipboard, switch view to plain text mode 
When i replace FlatButton:: on MainWindow:: it's working but the cursor change type when enter or live MainWindow but i want to change him only on button. For this reason i created FlatButton.

I don't know where i do wrong. I would be grateful for help.