android return key behaviour enhancements

This commit is contained in:
doitux
2012-12-21 00:36:01 +01:00
parent 5a869691e4
commit 5a87ce08b3
10 changed files with 152 additions and 2 deletions
@@ -28,6 +28,7 @@ createNetworkGameDialogImpl::createNetworkGameDialogImpl(QWidget *parent, Config
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
#endif
setupUi(this);
this->installEventFilter(this);
myChangeCompleteBlindsDialog = new changeCompleteBlindsDialogImpl;
@@ -128,3 +129,38 @@ void createNetworkGameDialogImpl::callChangeBlindsDialog(bool show)
}
}
bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
#ifdef ANDROID
//androi changes for return key behavior (hopefully useless from necessitas beta2)
if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) {
if(spinBox_startCash ->hasFocus()) {
spinBox_startCash->clearFocus();
}
if(spinBox_quantityPlayers->hasFocus()) {
spinBox_quantityPlayers->clearFocus();
}
if(spinBox_netTimeOutPlayerAction->hasFocus()) {
spinBox_netTimeOutPlayerAction->clearFocus();
}
if(spinBox_netDelayBetweenHands->hasFocus()) {
spinBox_netDelayBetweenHands->clearFocus();
}
event->ignore();
return false;
}
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject();
return true;
}
else {
// pass the event on to the parent class
return QDialog::eventFilter(obj, event);
}
#else
return QDialog::eventFilter(obj, event);
#endif
}