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

Bo Thorsen bo at vikingsoft.eu
Wed Aug 13 12:38:42 CEST 2014

Den 13-08-2014 10:19, Rutledge Shawn skrev:
> On 13 Aug 2014, at 5:33 AM, hualet wrote:
>> Hi, all
>> There’s a frameless QQuickWindow which contains my actual qml content stuff in my application, and I just used the setX() and setY() method of that window to simulate moving, but it’s not able to move that window to an negative position, such as (-100, -100), please help, thanks.
> Are you trying to get the sliding-panel effect, so you wanted to slide the window offscreen?  I'm interested in that too.
> In general, the success of explicitly setting window geometry depends on your window manager.  It's never guaranteed: X11 policy is that it's just a suggestion.  (As we are discussing in another thread, on Wayland it seems windows cannot be moved programmatically at all: only the user can do it, interactively.  Therefore we should de-emphasize such use cases, because they are not guaranteed to work.)  I did experiments with animating window position and found that OpenBox allows a lot more than KWin does, for example.  Then I was wondering if there could be a way to have a window which is virtually its maximum size all the time but becomes transparent when retracted, and also lets through the mouse events etc.  Because even if the WM allows animating position (or size), there is no guarantee that it will be done at a high enough frame rate to look good.  It's ironic that the animations are so trivial to write in QML and yet work so poorly.  It may not be possible to have that meth
od working well.

I think you can do this without doing anything outside the window.
Untested from the top of my head:

Item {
  property bool contentVisible: false

  width: contentVisible ? content.width : 0
  height: content.height
  clip: true

  Item {
    id: content
    anchors.right: parent.right
    ... // Actual contents here

  Behaviour on width {
    NumberAnimation {
      duration: 300
      easing.type: Easing.InOutQuad

I hope this helps.

Viking Software
Qt and C++ developers for hire

More information about the Interest mailing list