Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
Description
Some of QPushButton code implementing the autoDefault property uses the QPushButtonPrivate::dialogParent() function to find the nearest QDialog:
bool QPushButton::autoDefault() const
{
Q_D(const QPushButton);
if(d->autoDefault == QPushButtonPrivate::Auto)
return ( d->dialogParent() != 0 );
return d->autoDefault;
}
but the focus event handlers check for the window() being a QDialog instead:
void QPushButton::focusInEvent(QFocusEvent *e)
{
Q_D(QPushButton);
if (e->reason() != Qt::PopupFocusReason && autoDefault() && !d->defaultButton)
QAbstractButton::focusInEvent(e);
}
This leads to inconsistent behavior and breaks the autoDefault property for QPushButtons that live in a QDialog that is not a toplevel window.