Hi. I am trying to do up a sliding dialog widget, which it will slide out from the right docked toolbar upon clicking on the tool button. Upon clicking on the tool button again, it will slide in back to the right docked toolbar.

Previously, this is what I have done. Basically, I show() and hide() my dialog widget.

Qt Code:
  1. void ToolBarPalettes::openPalette()
  2. {
  3. if(openPaletteButton->isChecked())
  4. {
  5. paletteDlg->show();
  6. }
  7. else
  8. {
  9. paletteDlg->hide();
  10. }
  11. }
To copy to clipboard, switch view to plain text mode 

I tried to do the following to allow it to animate (slide out) from the toolbar. However, when I click on my tool button, nothing happens. The dialog widget did not slide out.

Qt Code:
  1. void ToolBarPalettes::openPalette()
  2. {
  3. if(openPaletteButton->isChecked())
  4. {
  5. QPropertyAnimation *animation = new QPropertyAnimation(paletteDlg, "geometry");
  6. animation->setDuration(3000);
  7. animation->setStartValue(QRect(-100, 50, paletteDlg->width(), paletteDlg->height()));
  8. animation->setEndValue(QRect(50, 50, paletteDlg->width(), paletteDlg->height()));
  9. animation->start();
  10. }
  11. else
  12. {
  13. QPropertyAnimation *animation = new QPropertyAnimation(paletteDlg, "geometry");
  14. animation->setDuration(3000);
  15. animation->setStartValue(QRect(50, 50, paletteDlg->width(), paletteDlg->height()));
  16. animation->setEndValue(QRect(-100, 50, paletteDlg->width(), paletteDlg->height()));
  17. animation->start();
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

Do I need to include the show() and hide() anywhere? Can anyone please help with this?
Thanks!