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

QApplication::activeWindow()->setFocus() throws an unhandled exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.7.0
    • Widgets: Main Window
    • None
    • Windows XP, Visual Studio 2008, Qt Integration

    Description

      I intended to get the main window of the application and set the keyboard focus on it.
      After heaving read the API documentation I recognize that this command does not do what I've intended.
      I understand that this is nonsense, as activeWindow() has already the keyboard focus.
      Nevertheless this should not cause a program to abbort.
      Call Stack:
      > QtGuid4.dll!QWidget::testAttribute(Qt::WidgetAttribute attribute=WA_Disabled) Line 1025 + 0x3 bytes C++
      QtGuid4.dll!QWidget::isEnabled() Line 930 + 0x11 bytes C++
      QtGuid4.dll!QWidget::setFocus(Qt::FocusReason reason=OtherFocusReason) Line 6109 + 0x8 bytes C++
      QtGuid4.dll!QWidget::setFocus() Line 420 + 0x11 bytes C++

      The documentation says:
      Warning: If you call setFocus() in a function which may itself be called from focusOutEvent() or focusInEvent(), you may get an infinite recursion.

      Please extend the documentation.
      Warning: activeWindow()->setFocus() might result in an unhandled exception

      or fix the program abbort.

      Attachments

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

        Activity

          People

            earthdomain Earth Domain (Inactive)
            gerhard w schuster Gerhard Walter Schuster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes