Remove unnecessary repetition of code and focusing of "Configure..." button by default that leads to unexpected opening of the chat configuration dialog or closing the chat dialog when you press Enter in the message field.
Details
Details
- Reviewers
aacid - Group Reviewers
KDE Games - Commits
- R395:dfb41994a3e5: Clean up the chat dialog code a bit, set the keyboard focus on the chat message…
Open the "Game -> Network Chat..." dialog, add some message and press Enter. Chat does not work as before (I cannot figure up why) but at least it does not open the configuration dialog and does not close either.
Diff Detail
Diff Detail
- Repository
- R395 KFourInLine
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 19827 Build 19845: arc lint + arc unit
Comment Actions
No. Ctrl+Enter works as expected (closes the chat dialog by triggering "OK"). The patch just prevents stealing focus from the message input field.
Comment Actions
But i mean by focus tabbing, focus tabbing is important for accessibility stuff too like screen readers for blnd people
Comment Actions
Adding one more false button restores the desired behavior. I'm lost. Need some advice.
Comment Actions
Does something like this fix the problem?
diff --git a/src/chatdlg.cpp b/src/chatdlg.cpp index 0b7ec1d..35a9ffe 100644 --- a/src/chatdlg.cpp +++ b/src/chatdlg.cpp @@ -50,11 +50,10 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent) QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - okButton->setDefault(true); + okButton->setAutoDefault(false); setModal(false); setMinimumSize(QSize(200,200)); @@ -68,6 +67,7 @@ ChatDlg::ChatDlg(KGame *game,QWidget *parent) mGridLayout->addWidget(b,0,0); QPushButton *mButton = new QPushButton(i18n("Configure..."),frame); + mButton->setAutoDefault(false); mGridLayout->addWidget(mButton,1,1); mainLayout->addWidget(frame);