I have the pointers set now, such as bottom in the cut out of my code. It works finaly, Thank You!!!
if((obj == ui->stackedWidget) && (ui->stackedWidget->currentIndex() == 1)){
if(ev
->type
() == QEvent::KeyPress) {
QKeyEvent *key
= dynamic_cast<QKeyEvent
*>
(ev
);
if(key->key() == Qt::Key_Control){
ui->stackedWidget->setCurrentIndex(0);
ui->stackedWidget->setCursor(Qt::ArrowCursor);
this->tcpSocket->closeSocket();
return true;
}
}
else{
this->position = this->mapToGlobal(this->pos());
int x = position.x(); int y=position.y();
this->cursor().setPos((x/2)+175, (y/2)+175);
return true;
}
return false;
}
}
bool MainWindow::eventFilter(QObject *obj, QEvent *ev){
if((obj == ui->stackedWidget) && (ui->stackedWidget->currentIndex() == 1)){
if(ev->type() == QEvent::KeyPress)
{
QKeyEvent *key = dynamic_cast<QKeyEvent*>(ev);
if(key->key() == Qt::Key_Control){
ui->stackedWidget->setCurrentIndex(0);
ui->stackedWidget->setCursor(Qt::ArrowCursor);
this->tcpSocket->closeSocket();
return true;
}
}
else{
this->position = this->mapToGlobal(this->pos());
int x = position.x(); int y=position.y();
this->cursor().setPos((x/2)+175, (y/2)+175);
return true;
}
return false;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks