Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.6
-
None
-
773f9ab01 (dev), 2c58f1770 (6.6), d37740437 (tqtc/lts-6.5), 599328845 (dev), fd710fbba (dev), d4f38a363 (dev), d71b73c14 (dev), 09eb99f01 (dev), b30f21468 (6.7), 88ba33442 (6.6), 49bfdf7e6 (6.7), 9720c6c00 (6.6), be80a8315 (tqtc/lts-6.5), 16ab2eba7 (6.7)
Description
A dialog that uses QDialogButtonBox, for example QMessageBox, may in some situations end up with a button that can't be tabbed to.
A test-case is e.g.:
QDialogButtonBox buttonBox; auto printFocusChain = [&]{ for (auto *button : buttonBox.buttons()) qDebug() << button->previousInFocusChain() << button << button->nextInFocusChain(); }; QDialogButtonBox::ButtonRole roles[] = { QDialogButtonBox::AcceptRole, QDialogButtonBox::AcceptRole, QDialogButtonBox::AcceptRole }; for (auto role : roles) { static int i = 0; auto *button = new QPushButton(QString("%1").arg(++i)); button->setObjectName(button->text()); QObject::connect(button, &QPushButton::clicked, [=]{ qDebug() << button->text(); printFocusChain(); }); buttonBox.addButton(button, role); } printFocusChain(); QTimer::singleShot(200, [&]{ printFocusChain(); }); buttonBox.show();
The initial focus chain is:
QDialogButtonBox(0x10bfa5230) QPushButton(0x10fcf4610, name="1") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf5910, name="2") QDialogButtonBox(0x10bfa5230) QPushButton(0x10fcf4610, name="1") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf5910, name="2")
but after QFocusFrame is added we end up with:
QDialogButtonBox(0x10bfa5230) QPushButton(0x10fcf4610, name="1") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf5910, name="2") QFocusFrame(0x120c3b2d0) QPushButton(0x10fcf4610, name="1") QPushButton(0x10fcf6750, name="3") QPushButton(0x10fcf5910, name="2")
Interestingly the buttons can all be tabbed to in reverse order (with shift).
Attachments
Issue Links
- relates to
-
QTBUG-120049 [REG 6.6.0 --> 6.6.1] Incorrect child widget has focus in dialog by default
- Closed
For Gerrit Dashboard: QTBUG-118489 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
530586,1 | Remove dead code from tst_QMessageBox::staticSourceCompat() | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: NEW | +2 | 0 |
540153,1 | Pass correct default button in QMessageBox::showNewMessageBox() | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: NEW | +2 | 0 |
540154,1 | QDialogButtonBox: Fix focus chain and default button assignment | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: NEW | +2 | 0 |