d44413d526
QDialogButtonBox has logic to automatically resolve a default button, in case one is not already set via QPushButton directly, or via e.g. QMessageBox::setDefaultButton(). Unfortunately, this default button can in some cases be overridden by the first button in the dialog button box. The reason this happens is that the first button is the focus proxy of the button box, so when the button box gains focus, it will transfer it to the first button. And since QPushButtons inside a QDialog have their autoDefault property set to true by default, this focus transfer will also reset the default button to the focused button. This arbitrarily happens for any role that happens to be earlier in the QDialogButtonBox::ButtonLayout than the AcceptRole, and can be very confusing for the user, so we try to avoid the situation by explicitly setting the automatic default button as the focus widget of the button box, unless one is set already. This is also what QMessageBox::setDefaultButton() does internally. The only case we're not covering is when the user sets a push button as default via QPushButton::setDefault(), but we conservatively assume that the user then also calls setFocus() on the button. Pick-to: 6.5 6.6 Change-Id: Ibdac0a51ba9439321d4fd7a1dac1ed695e11d693 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake |