Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-2330

QPushButton autoDefault property does not work if the QDialog parent lives in a QMdiArea

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • None
    • GUI: Workspace
    • 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)

      { d->defaultButton = true; QDialog *dlg = qobject_cast<QDialog*>(window()); if (dlg) dlg->d_func()->setDefault(this); }

      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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bjnilsen Bjørn Erik Nilsen
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes