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

OS X: QWidget::isFullScreen reports wrong value when using native full screen UI (arrow top-right)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • 5.3.0
    • 5.2.1
    • GUI: Window management
    • None
    • Qt 5.2.1 (binary download), on OS X 10.8.5 as well as on OS X 10.9.1
    • macOS

    Description

      The scenario: whenever the window (QWidget based) is resized, specifically when it goes from "normal view" into "full screen" and vice versa, a given QAction text is to be updated ("Enter Full Screen", "Exit Full Screen"). The status of the window ("full screen") is queried at the point the window is resized (QResizeEvent).

      Bug: when the window is put into "full screen" state with the "native full screen title decorator (arrow)", then QWidget::isFullScreen() reports still "false". This is in contrast to when putting the window into the "full screen" state with the corresponding Qt API QWidget::showFullScreen(): then at the point of window resize (the "native full screen animation") QWidget::isFullScreen() reports "true" (as expected).

      Note that the corresponding Cocoa API always reports the correct value:

          NSUInteger mask = [nswindow styleMask];
          bool fullScreen = mask & NSFullScreenWindowMask;
      

      (This could also be a hint on how to solve this issue and is my current workaround)

      How to reproduce:

      • Compile (qmake; make) and run the attached example
      • Click on "Enter Full Screen" (which triggers the Qt API QWidget::showFullScreen() to go full screen)
      • Good: the window goes full screen, the button text changes to "Exit Full Screen" and both checkboxes are enabled (they represent the values of QWidget::isFullScreen() ("Qt" checkbox) and the above native Cococa code ("Native" checkbox)
      • Click again on the same button (now labeled "Exit Full Screen")
      • Good: both checkboxes are unchecked and the label is restored to the previous value
      • Now click on the "native full screen GUI" top-right arrows in the title
      • Bad: Only the "native Cocoa" API reports that the widget is now "full screen" and hence the "Qt" checkbox remains unchecked and hence the button text remains "Enter Full Screen"
      • Click on the Update button
      • (Only) At this point the Qt API is convinced that the widget is now full screen
      • Click again on the arrows top-right (this time in the men bar)
      • Bad: The "Qt" checkbox remains checked and hence the button text remains "Exit Full Screen"
      • Click on the Update button
      • (Only) At this point the Qt API is convinced that the widget is now in normal view again

      Workaround:

      • Use native Cocoa code (*.mm) and link with the Cocoa framework, as shown in the example code (which also enables ARC, hence the funny double-cast from winID to NSView)

      bool fullScreen = masks & NSFullScreenWindowMask;

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            till213 Oliver Knoll
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes