Hey, at first i must apologize for my poor english. I am new in Qt and seek for an solution of the follow issue. First my code:

Qt Code:
  1. bool MainWindow::eventFilter(QObject *obj, QEvent *ev){
  2. if((obj == ui->stackedWidget) && (ui->stackedWidget->currentIndex() == 1)){
  3. if(ev->type() == QEvent::KeyPress)
  4. {
  5. QKeyEvent key = static_cast<QKeyEvent>(ev);
  6. if(key.key() == Qt::Key_Control){
  7.  
  8. ui->stackedWidget->setCurrentIndex(0);
  9. this-> tcpSocket->closeSocket();
  10.  
  11. }
  12.  
  13. }
  14. else{
  15. QPoint position = this->mapToGlobal(this->pos());
  16. int x = position.x(); int y=position.y();
  17. this->cursor().setPos((x/2)+175, (y/2)+175);
  18. }
  19.  
  20. return true;
  21. }
  22.  
  23. }
To copy to clipboard, switch view to plain text mode 

after my attempt to check wether control key was pressed, about a key event in this function, i received folllow error message:

Error: no matching function for call to 'QKeyEvent::QKeyEvent(QEvent*&)'
QKeyEvent key = static_cast<QKeyEvent>(ev);

somebody has an idea??