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> |
||
---|---|---|
.. | ||
auto | ||
baseline | ||
benchmarks | ||
global | ||
libfuzzer | ||
manual | ||
shared | ||
testserver | ||
CMakeLists.txt | ||
README |
This directory contains autotests and benchmarks based on Qt Test. In order to run the autotests reliably, you need to configure a desktop to match the test environment that these tests are written for. Linux X11: * The user must be logged in to an active desktop; you can't run the autotests without a valid DISPLAY that allows X11 connections. * The tests are run against a KDE3 or KDE4 desktop. * Window manager uses "click to focus", and not "focus follows mouse". Many tests move the mouse cursor around and expect this to not affect focus and activation. * Disable "click to activate", i.e., when a window is opened, the window manager should automatically activate it (give it input focus) and not wait for the user to click the window.