Results 1 to 8 of 8

Thread: Sliding popup widget

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Sliding popup widget

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sliding popup widget

    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

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Sliding popup widget

    A similiar solution has already been pointed out in a previous thread:
    http://www.qtcentre.org/forum/f-qt-p...light=momesana
    I'll try that, but I wonder if there is a more elegant way to achieve it?

    Thanx
    momesana

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sliding popup widget

    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

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Sliding popup widget

    Quote Originally Posted by marcel View Post
    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/...lidewindow.ogg

    Cheers
    momesana

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Sliding popup widget

    Check qScrollEffect() in src/gui/widgets/qeffects.cpp.
    J-P Nurmi

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Sliding popup widget

    Quote Originally Posted by jpn View Post
    Check qScrollEffect() in src/gui/widgets/qeffects.cpp.
    QtCentre wiki: Fade and Scroll Effects
    J-P Nurmi

  8. The following user says thank you to jpn for this useful post:

    momesana (19th September 2007)

  9. #8
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Sliding popup widget

    Quote Originally Posted by jpn View Post
    Great Addition. Thanks alot.

Similar Threads

  1. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  2. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  3. Can't close my popup
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2006, 09:10
  4. Pin/Unpin Dock Widget
    By charlesD in forum Newbie
    Replies: 1
    Last Post: 21st June 2006, 06:57
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.