Results 1 to 6 of 6

Thread: MainWindow animation -- sliding panel

  1. #1
    Join Date
    May 2013
    Posts
    11
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default MainWindow animation -- sliding panel

    Hi, I want to add sliding panel to my MainWindow, so I am trying to use the QPropertyAnimation;

    Qt Code:
    1. animation = new QPropertyAnimation(ui->centralWidget, "geometry");
    2. animation->setDuration(10000);
    3. animation->setStartValue(QRect(0,0,356,330));
    4. animation->setEndValue(QRect(0,0,450,330));
    To copy to clipboard, switch view to plain text mode 

    and activating it by a PushButton :

    Qt Code:
    1. void MainWindow::buttonSlideClicked()
    2. {
    3. animation->start();
    4. }
    To copy to clipboard, switch view to plain text mode 

    but it doesn't work. What I have to do to make it.

  2. The following user says thank you to Noob for this useful post:


  3. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MainWindow animation -- sliding panel

    Please define what "doesn't work" means in this situation. Is ui->centralWidget part of a layout (if it's the central widget of a main window then it is)? Geometry of widgets that are managed by layouts cannot be controlled by the geometry property because the layout will override those values.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following user says thank you to wysota for this useful post:


  5. #3
    Join Date
    May 2013
    Posts
    11
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: MainWindow animation -- sliding panel

    dosen't work means, that slideButton clicked dosen't slide the panel.

    Yes, centralWidget is a MainWindow widget. If it cannot be controlled this way, how can I acces the geometry properties of this widget? I tried tu constract the animation with the MainWindow object (QMainWindow) but the compiler says, this is an invalid use of the MainWindow.

    Thanks for answer, cheers

    In a shortcut i want to make the MainWindow bigger on a clickButton.

  6. The following user says thank you to Noob for this useful post:


  7. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MainWindow animation -- sliding panel

    You can put your panel inside the central widget of the main window (but don't make it part of a layout) and then animate it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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


  9. #5
    Join Date
    May 2013
    Posts
    11
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: MainWindow animation -- sliding panel

    Well, I put a new widget inside the centralWidget. I ve got there one gridLayout and its outside of this. How can I ensure that it dosen't belong to any default layout? Becouse theres still no action by clicking my connected button;

    I khnow it's a lot of question, but I am completly new in Qt, I'm reading still but theres a lot of information.

  10. The following user says thank you to Noob for this useful post:


  11. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MainWindow animation -- sliding panel

    If you don't put it in a layout then it is not part of a layout. If animation doesn't work, it doesn't mean it has to be because of the layout.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. The following user says thank you to wysota for this useful post:


Similar Threads

  1. Replies: 2
    Last Post: 30th January 2013, 19:06
  2. Replies: 1
    Last Post: 27th July 2012, 16:33
  3. sliding dock widget
    By manishkyl in forum Qt Programming
    Replies: 0
    Last Post: 28th July 2008, 14:04
  4. Sliding popup widget
    By momesana in forum Qt Programming
    Replies: 7
    Last Post: 19th September 2007, 22:30
  5. how to create sliding progress bar ?
    By npc in forum Newbie
    Replies: 2
    Last Post: 26th March 2007, 17:40

Tags for this Thread

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.