android return key behaviour enhancements
This commit is contained in:
@@ -29,6 +29,7 @@ changeCompleteBlindsDialogImpl::changeCompleteBlindsDialogImpl(QWidget *parent,
|
||||
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
||||
#endif
|
||||
setupUi(this);
|
||||
this->installEventFilter(this);
|
||||
|
||||
connect( pushButton_add, SIGNAL( clicked() ), this, SLOT( addBlindValueToList() ) );
|
||||
connect( pushButton_delete, SIGNAL( clicked() ), this, SLOT( removeBlindFromList() ) );
|
||||
@@ -92,3 +93,42 @@ void changeCompleteBlindsDialogImpl::sortBlindsList()
|
||||
listWidget_blinds->clear();
|
||||
listWidget_blinds->addItems(tempStringList);
|
||||
}
|
||||
|
||||
|
||||
bool changeCompleteBlindsDialogImpl::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_afterThisAlwaysRaiseValue->hasFocus()) {
|
||||
spinBox_afterThisAlwaysRaiseValue->clearFocus();
|
||||
}
|
||||
if(spinBox_firstSmallBlind->hasFocus()) {
|
||||
spinBox_firstSmallBlind->clearFocus();
|
||||
}
|
||||
if(spinBox_input->hasFocus()) {
|
||||
spinBox_input->clearFocus();
|
||||
}
|
||||
if(spinBox_raiseSmallBlindEveryHands->hasFocus()) {
|
||||
spinBox_raiseSmallBlindEveryHands->clearFocus();
|
||||
}
|
||||
if(spinBox_raiseSmallBlindEveryMinutes->hasFocus()) {
|
||||
spinBox_raiseSmallBlindEveryMinutes->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
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
changeCompleteBlindsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
|
||||
|
||||
void exec();
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
public slots:
|
||||
bool getSettingsCorrect() const {
|
||||
|
||||
@@ -27,6 +27,7 @@ changeContentDialogImpl::changeContentDialogImpl(QWidget *parent, ConfigFile *co
|
||||
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
||||
#endif
|
||||
setupUi(this);
|
||||
this->installEventFilter(this);
|
||||
|
||||
switch (myType) {
|
||||
case CHANGE_HUMAN_PLAYER_NAME: {
|
||||
@@ -106,3 +107,30 @@ void changeContentDialogImpl::saveContent()
|
||||
myConfig->writeBuffer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool changeContentDialogImpl::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(lineEdit->hasFocus()) {
|
||||
lineEdit->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
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ class changeContentDialogImpl: public QDialog, public Ui::changeContentDialog
|
||||
Q_OBJECT
|
||||
public:
|
||||
changeContentDialogImpl(QWidget *parent, ConfigFile *config, DialogType t);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() {
|
||||
return myChangeCompleteBlindsDialog;
|
||||
}
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
changeCompleteBlindsDialogImpl* getChangeCompleteBlindsDialog() {
|
||||
return myChangeCompleteBlindsDialog;
|
||||
}
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ bool internetGameLoginDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||
|
||||
#ifdef ANDROID
|
||||
//androi hack for crash bug (hopefully useless from necessitas beta2)
|
||||
//androi changes for return key behavior (hopefully useless from necessitas beta2)
|
||||
if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) {
|
||||
if(lineEdit_username->hasFocus()) {
|
||||
lineEdit_password->setFocus();
|
||||
|
||||
@@ -87,7 +87,7 @@ bool newGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
|
||||
|
||||
#ifdef ANDROID
|
||||
//androi hack for crash bug (hopefully useless from necessitas beta2)
|
||||
//androi changes for return key behavior (hopefully useless from necessitas beta2)
|
||||
if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) {
|
||||
if(spinBox_gameSpeed->hasFocus()) {
|
||||
spinBox_gameSpeed->clearFocus();
|
||||
|
||||
Reference in New Issue
Block a user