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

Windows Frameless Window creates black frame when change screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0
    • None
    • Windows 10, Intel Graphics
    • Windows

    Description

      I used a example from github which generates a true frameless window in windows.

      Check it out here!

      The problem occurs only if we add a QQuickWidget as content and move the window to another screen. After reaching the other screen we got a black frame around the widget/window. Seems to be a OpenGL error discussed here: Bug  There is also a cursor offset when this border is displayed.

      Also maybe related: QTBUG-40485

       

       

      Solution:

      I'm able to fix this by overwrite the moveEvent (as found here):

      class CFramelessWindow: public QMainWindow
      {
          // rest of the class
      
      private:
      
          QScreen* current_screen = nullptr;
      
          void moveEvent(QMoveEvent* event)
          {
              if (current_screen == nullptr)
              {
                  current_screen = screen();
              }
              else if (current_screen != screen())
              {
                  current_screen = screen();
      
                  SetWindowPos((HWND) winId(), NULL, 0, 0, 0, 0,
                               SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
                               SWP_NOOWNERZORDER | SWP_FRAMECHANGED | SWP_NOACTIVATE);
              }
      
          }
      };
      

       

       The example (code from git with fix) is attached.

      Attachments

        1. image-2021-01-28-00-09-58-201.png
          14 kB
          Pascal Steinmüller
        2. Qt-Nice-Frameless-Window.zip
          2.22 MB
          Pascal Steinmüller
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            p.steinmueller Pascal Steinmüller
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes