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
@@ -30,6 +30,7 @@ createInternetGameDialogImpl::createInternetGameDialogImpl(QWidget *parent, Conf
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
#endif
setupUi(this);
this->installEventFilter(this);
comboBox_gameType->setItemData(0, GAME_TYPE_NORMAL, Qt::UserRole);
comboBox_gameType->setItemData(1, GAME_TYPE_REGISTERED_ONLY, Qt::UserRole);
@@ -231,3 +232,44 @@ void createInternetGameDialogImpl::gameTypeChanged()
myChangeCompleteBlindsDialog->radioButton_afterThisStayAtLastBlind->setChecked(myConfig->readConfigInt("NetAfterMBStayAtLastBlind"));
}
}
bool createInternetGameDialogImpl::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();
}
if(lineEdit_gameName->hasFocus()) {
lineEdit_gameName->clearFocus();
}
if(lineEdit_Password->hasFocus()) {
lineEdit_Password->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
}