PDA

View Full Version : how to shift the focus to enter



gu574vo
27th October 2010, 22:32
I tried using this way but I did not succeed, the focus disappears and does not go to the next.


void Login::keyPressEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Enter)
{
this->nextInFocusChain()->setFocus();

}
}

thanks for help!

wysota
27th October 2010, 22:37
Simpy call QWidget::focusNextPrevChild(true).

gu574vo
27th October 2010, 22:45
Thanks, is perfect.


void Login::keyPressEvent(QKeyEvent *event)
{
if(event->key()==Qt::Key_Enter)
{
this->focusNextPrevChild(true);

}
}