Hi guys,

i try to do this simple animation:



the layout of window is grid (for window autoresize).

the first animation where frame 1 go out run correctly, but the second animation where frame 2 go inside the window not run correctly... the animation flicker...

this is the code:
[where:
Button 1=ButtonLogin;
Frame 1= login;
frame 2= linkedin;]

Qt Code:
  1. //QWidget_home.cpp
  2.  
  3. Home::Home(QWidget *parent) :
  4. QWidget(parent),
  5. ui(new Ui::Home)
  6. {
  7. ui->setupUi(this);
  8. inizio();
  9. }
  10.  
  11. void Home::inizio()
  12. {
  13. databaseOn(); //read data from sql Database
  14. hideall();
  15. ui->Login->show(); //show the frame 1
  16.  
  17. //set the image and labels in all frame
  18. QPixmap immagine(":/immagine1.jpg");
  19. ui->labelimage->setPixmap(immagine);
  20. QPixmap immaginelogin(":/loginlogo.png");
  21. ui->labelloginimage->setPixmap(immaginelogin);
  22. ui->linePassword->setEchoMode(QLineEdit::Password);
  23. QPixmap immaginewelcome(":/welcome.png");
  24. ui->labelWelcome->setPixmap(immaginewelcome);
  25. }
  26.  
  27. void Home::hideall(){ //hide all
  28. ui->Login->hide();
  29. ui->Linkedin->hide();
  30. ui->ModificaProfilo->hide();
  31. }
  32.  
  33. //[...]
  34.  
  35. void Home::on_pushButtonLogin_clicked()
  36. {
  37.  
  38. //convert data in form for the database (is a vector)
  39. bool logged=true;
  40. QString * s= new QString[2];
  41. s[0]=ui->lineUsername->text();
  42. s[1]=ui->linePassword->text();
  43. try{
  44. cercami(s);
  45. }catch (errori){
  46. ui->lineUsername->clear();
  47. ui->linePassword->clear();
  48. logged=false;
  49. }
  50. //try to read data from vector
  51.  
  52. try {
  53. scriviProfilo(logged); //try to complete the label of frame linkedin with database information
  54. } catch (errori) {}
  55.  
  56. //show frame 2
  57. showLinkedin();
  58.  
  59. }
  60.  
  61. //[...]
  62.  
  63. void Home::showLinkedin() { //hide the frame1
  64.  
  65.  
  66. int dimensioneLarghezza=geometry().width()-24;
  67. int dimensioneAltezza=geometry().height()-24;
  68. int dimensioneX=12;//ui->Login->geometry().x();
  69. int dimensioneY=12;//ui->Login->geometry().y();
  70. int surplus=geometry().width()-24;
  71.  
  72. QPropertyAnimation *animation = new QPropertyAnimation(ui->Login, "geometry");
  73. animation->setDuration(500);
  74. animation->setStartValue(QRect(dimensioneX,dimensioneY,dimensioneLarghezza ,dimensioneAltezza ));
  75. animation->setEndValue(QRect(-(dimensioneX+surplus),dimensioneY, dimensioneLarghezza ,dimensioneAltezza));
  76. animation->setEasingCurve(QEasingCurve::InOutExpo);
  77. animation->start(QAbstractAnimation::DeleteWhenStopped);
  78. connect(animation, SIGNAL(finished()), SLOT(hideLoginAnimationEnd())); //when is hide show frame 2
  79. }
  80.  
  81. void Home::hideLoginAnimationEnd(){ //show frame 2
  82. ui->Login->hide();
  83.  
  84. ui->Linkedin->show();
  85.  
  86. qDebug()<<geometry().width();
  87. qDebug()<<geometry().height();
  88. int dimensioneLarghezza=geometry().width()-24;
  89. int dimensioneAltezza=geometry().height()-24;
  90. int dimensioneX=12;
  91. int dimensioneY=12;
  92. int surplus=geometry().width()-24;
  93.  
  94.  
  95.  
  96. QPropertyAnimation *animation = new QPropertyAnimation(ui->Linkedin, "geometry");
  97. animation->setDuration(500);
  98. animation->setStartValue(QRect(dimensioneX+surplus,dimensioneY, dimensioneLarghezza, dimensioneAltezza));
  99. animation->setEndValue(QRect(dimensioneX,dimensioneY, dimensioneLarghezza, dimensioneAltezza));
  100. animation->setEasingCurve(QEasingCurve::InOutExpo);
  101. animation->start();
  102. }
To copy to clipboard, switch view to plain text mode 

someone can help me?

Thanks.