[Interest] MouseArea failed to handle onPositionChanged to a frameless ApplicationWindow in Qt 5.2.1

Leslie Zhai xiangzhai83 at gmail.com
Wed May 7 10:33:46 CEST 2014


Hi Rutledge,

openbox is cool and I am maintaining (migrated to Qt5.2.x) EggWM a very 
simple WM such as tinywm https://github.com/xiangzhai/eggwm

I only experienced the hacked (changed window frame with cairo) weston 
https://github.com/xiangzhai/weston and mutter-wayland GNOME`s WM 
supports wayland, but I have not built Qt Wayland successfully on my 
box... then I changed my attention to the X11 at present.

And Qt5.2.x changed a lot comparied with Qt4.x, for example, there is 
QAbstructEventFilter for X11, Wayland, WIN32, Mac... I am familiar with 
it by migrating PackageKit-Qt https://github.com/AOSC-Dev/PackageKit-Qt 
to 5.2.x or other open source projects, so I only found a few issues 
about migration from Qt4 to Qt5, but the co-developers of AnthonOS 
http://www.anthonos.org might found other issues, I will email to your 
nice guys :)

Regards,
Leslie Zhai <xiang.zhai at i-soft.com.cn>

> On 7 May 2014, at 8:52 AM, Leslie Zhai wrote:
>
>> Hi Rutledge,
>>
>> Thanks for your reply :)
>>
>> It is might be the WINDOW MANAGER issue, for example, KWin (the KDE`s) is not able to handle QML frameless Window correctly, when you drag the window title over the borders (for example, over the top of screen)
> Yes, it looks like KWin doesn't allow any part of the window to go outside the edge of the desktop, and it's the same with gnome 3, even though you can drag the window by its titlebar such that part of the window goes outside.  OpenBox does allow it.  I'm not sure if we can force it somehow on window managers which don't.  I wish we could, because it enables slide-out windows without needing to resize them on the fly.
>
> Being able to do this is also uncertain on wayland, BTW; last time I tried I was not able to drag the window this way at all, but I don't understand yet if that's a bug or is intentional.
>
> Is that the only issue that you've found?
>
>> Regards,
>> Leslie Zhai <xiang.zhai at i-soft.com.cn>
>>
>>> On 7 May 2014, at 4:50 AM, Leslie Zhai wrote:
>>>
>>>> Hi qt developers,
>>>>
>>>> I use MouseArea to act like DragArea to move the frameless
>>>> ApplicationWindow in Qt5.2.1
>>>> https://github.com/AOSC-Dev/QJade/blob/master/qml/DragArea.qml#L17
>>>>
>>>> But Window Cannot Be Moved Over the Borders the Screen
>>>> https://github.com/AOSC-Dev/QJade/issues/5
>>>>
>>>> Please someone show me how to fix it, thanks a lot!
>>> I was testing that a couple of years ago, as follows:
>>>
>>> import QtQuick 2.1
>>> import QtQuick.Window 2.0
>>>
>>> Window {
>>>      id: window
>>>      visible: true
>>>      width: 100
>>>      height: 100
>>>      flags: Qt.FramelessWindowHint
>>>
>>>      Rectangle {
>>>          color: "steelblue"
>>>          anchors.top: parent.top
>>>          width: parent.width
>>>          height: 20
>>>          MouseArea {
>>>              anchors.fill: parent
>>>              property real lastMouseX: 0
>>>              property real lastMouseY: 0
>>>              onPressed: {
>>>                  lastMouseX = mouseX
>>>                  lastMouseY = mouseY
>>>              }
>>>              onMouseXChanged: window.x += (mouseX - lastMouseX)
>>>              onMouseYChanged: window.y += (mouseY - lastMouseY)
>>>          }
>>>      }
>>> }
>>>
>>> I can drag this across both monitors on a dual-head system, either OSX or Linux; and if I wrap your code into a standalone test, it also works:
>>>
>>> import QtQuick 2.2
>>> import QtQuick.Window 2.1
>>>
>>> Window {
>>>      id: rootWindow
>>>      visible: true
>>>      width: 100
>>>      height: 100
>>>      MouseArea {
>>>          cursorShape: Qt.ArrowCursor
>>>          anchors.fill: parent
>>>
>>>          property variant clickPos: "1, 1"
>>>
>>>          onPressed: {
>>>              cursorShape = Qt.SizeAllCursor
>>>              clickPos = Qt.point(mouse.x, mouse.y)
>>>          }
>>>
>>>          onPositionChanged: {
>>>              var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
>>>              rootWindow.x += delta.x
>>>              rootWindow.y += delta.y
>>>          }
>>>
>>>          onExited: cursorShape = Qt.ArrowCursor
>>>      }
>>> }
>>>




More information about the Interest mailing list