PDA

View Full Version : Sliding popup widget



momesana
10th September 2007, 16:21
Hi all,
I wonder how to implement a popup-widget that slides out of the top of the Statusbar. Amarok has such a popup widget and I wonder how this can be properly implemented in Qt4. Moving the widget is not the problem, but rather the fact that it slides out of nothing which means that a portion of it needs to be invisible while it slides out/in. Do I need to mask the invisible part or how else can I accomplish this effect?


Thanx in advance
momesana

marcel
10th September 2007, 17:00
I can think of one way to do it, but your widget will have to be fixed size.

This is based on the property of widgets to clip their children.
You must have a container widget that has initially an empty size and a the widget you want to display(at real size). Add the widget to the empty widget in a vertical layout.

Next all you have to do is to increase the size of the container and move it accordingly(something to look like a slide) until the container
reaches the size of the widget.
So, this should be enough.

Regards

momesana
10th September 2007, 17:30
A similiar solution has already been pointed out in a previous thread:
http://www.qtcentre.org/forum/f-qt-programming-2/t-qwidgtemoveint-x-int-y-beyond-the-screen-boundaries-5655.html/?highlight=momesana
I'll try that, but I wonder if there is a more elegant way to achieve it?

Thanx
momesana

marcel
10th September 2007, 17:43
Another solution is to use just then widget you want to slide and redirect it's painting to another paint device - a pixmap for example. At each frame you draw only the rect that should be visible at that moment.
But I think this is a little harder to implement.

Regards

momesana
11th September 2007, 00:33
Another solution is to use just then widget you want to slide and redirect it's painting to another paint device ...
Could you elaborate on that? I don't know how to redirect the painting to another paintdevice. Unfortunately I do not have any experience in this regard. Right now I've written a primitive prototype that uses a QTimeLine and calculates the visible rect upon every frameChanged() signal. Here is a short screencast: http://www.informatik.uni-bremen.de/~momesana/slidewindow.ogg

Cheers
momesana

jpn
11th September 2007, 09:36
Check qScrollEffect() in src/gui/widgets/qeffects.cpp. ;)

jpn
18th September 2007, 20:01
Check qScrollEffect() in src/gui/widgets/qeffects.cpp. ;)
QtCentre wiki: Fade and Scroll Effects (http://wiki.qtcentre.org/index.php?title=Fade_and_Scroll_Effects)

momesana
19th September 2007, 22:30
QtCentre wiki: Fade and Scroll Effects (http://wiki.qtcentre.org/index.php?title=Fade_and_Scroll_Effects)
Great Addition. Thanks alot.