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

Gunnar Sletta gunnar.sletta at jolla.com
Thu Aug 14 08:09:36 CEST 2014


As Thiago and Giulio has already pointed out, this may work on some window managers. On others it might not. 

Qt sits on the application side of things, it is not the window system side of things. That means that Qt has very few capabilities beyond requesting a window to be shown, asking the system to give the window a geometry and location. These are just hints. A window manager is free to ignore some or all. 

That means that any application that assumes system-level capabilities will have problems when ported to other platforms. Those requests can be synchronous or asynchronous or simply ignored and overruled by the window manager.

That might be fine if you target a single OS or a single window manager (or a small subset), but by doing so, one should be fully aware of that the application is written for that subset. If that limitation works, then no problems, open as many windows you like and move them around :)

A well-behaving cross platform application should request to be shown at an initial size and then leave it at that.

cheers,
Gunnar

On 13 Aug 2014, at 16:09, Rutledge Shawn <Shawn.Rutledge at digia.com> wrote:

> 
> 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).
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list