[Interest] sliding panel windows (was Re: Moving a frameless QQuickWindow to negative position under linux)

Rutledge Shawn Shawn.Rutledge at digia.com
Wed Aug 13 16:09:14 CEST 2014

On 13 Aug 2014, at 3:04 PM, hualet wrote:

> Thanks for you reply, Shawn. 
> I’m not trying to get the sliding-panel effect, in fact, my window is just the main window of a regular video player,
> what I want is the window can be dragged like other windows, now it works pretty fine so far except that when I dragged it to the top left corner of the screen and wanna go on it just was stuck there, sorry for my poor English, can you understand me ?

So it has no title bar but you need the behavior that is usually achieved by dragging the titlebar?

One of my experiments is this

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)

(run with the qml tool)

It works better on some OSes and window managers than others.

Now it has been explained on the Wayland thread that interactive dragging is a different protocol on both Wayland and X11 (http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140146176808576 for X11).  But I'm not aware of a way to programmatically initiate interactive dragging in Qt; but this use case might benefit from one.  There is private API QPlatformWindow::startSystemResize() which so far seems to be used only in QSizeGrip.

At least many X11 window managers allow you to alt-drag any window (hold down the alt key and drag any window from any point inside).

More information about the Interest mailing list