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

startSystemMove and startSystemResize does not enable aero snap on windows with frameless window.

    XMLWordPrintable

    Details

    • Platform/s:
      Windows

      Description

      On Windows startSystemMove and startSystemResize DOES NOT trigger aero snap on frameless windows as suggested by the following blog post:

      https://www.qt.io/blog/custom-window-decorations

      Note that it's also suggested in https://doc.qt.io/qt-5/qwindow.html#startSystemMove

       

      You could try with the following example:

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Window 2.15
      
      ApplicationWindow {
          width: 640
          height: 480
          flags: Qt.FramelessWindowHint | Qt.Window
          visible: true
      
          background: Rectangle {
             border.color: handler.active ? "green" : "red"
             border.width: 1
          }
      
          Item {
              anchors.fill: parent
      
              DragHandler {
                  id: handler
                  onActiveChanged: if (active) startSystemMove()
              }
          }
      }
      

       

       

      This is an interresting feature, but since it does not work properly, it feel useless, at least on Windows.

       

      Note that I achived to implements the aero snap feature, and also the  drop shadow, but this needs a bit of Windows specific C++ code to works:

      • Needs to react to the WM_NCCALCSIZE event.
      • Needs to use the QtWin::extendFrameIntoClientArea.
      • Needs to set back some window native flags after settings Qt ones: WS_POPUP | WS_CAPTION | WS_THICKFRAME

      So this is not currently possible with pure QML.

       

      It would be nice in fact to have a bit more control over the windows via some flags, something like:

      • Qt.SnapWindowHint add the native flags to force snapping support on the windows (in addition with Qt.FramelessWindowHint)
      • Qt.DropShadowWindowHint add the native flags to force window shadow (in addition with Qt.FramelessWindowHint) or to allow Qt to emulate it.

       

       

       

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-84466
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              owolff Oliver Wolff
              Reporter:
              greenwolf Benoît Gradit
              PM Owner:
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              13 Vote for this issue
              Watchers:
              17 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews