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

    • Windows
    • cfe421cee2 (qt/qtbase/dev) 58fdd0f01b (qt/qtbase/6.3) e336e062ef (qt/qtbase/6.2) e336e062ef (qt/tqtc-qtbase/6.2) 58fdd0f01b (qt/tqtc-qtbase/6.3) 58fdd0f01b (qt/tqtc-qtbase/6.3.0)

    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

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

          Activity

            People

              owolff Oliver Wolff
              jirauser37625 user-3288b (Inactive)
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              16 Vote for this issue
              Watchers:
              23 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: