android return key behaviour enhancements
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user