Results 1 to 10 of 10

Thread: Load new view (.ui) from the previous view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Load new view (.ui) from the previous view

    Agreed. I think it is a quite dangerous thing to put in the hands of a user who could make changes that destroy an app's GUI.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. #2
    Join Date
    Nov 2016
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Load new view (.ui) from the previous view

    Hi, Thanks for the replies both of you. Sorry, but I am still confused. Not sure how to use QAbstractAnimation:: finished () linking to the hiding of parent view.

    Qt Code:
    1. QPropertyAnimation *animation = new QPropertyAnimation(parent, QString("windowOpacity").toLatin1());//windowOpacity");
    2. QPropertyAnimation *animation2 = new QPropertyAnimation(second, QString("windowOpacity").toLatin1());//"windowOpacity");
    3. animation->setDuration(3000);
    4. animation2->setDuration(3000);
    5. animation2->setStartValue(0.0);
    6. ui->centralWidget->setEnabled(true);
    7. second->show();
    8. animation->setStartValue(1.0);
    9.  
    10. animation->setEndValue(0.0);
    11. animation2->setEndValue(1.0);
    To copy to clipboard, switch view to plain text mode 

    I am doing the above code, but now things are running very quickly and I cant see any animation, only the second view. The first parent view is visible but behind the second view.
    Last edited by das.joyita; 5th December 2016 at 11:32.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Load new view (.ui) from the previous view

    Qt Code:
    1. void MainWindow::dissolve( QWidget * pFadeOut, QWidget * pFadeIn )
    2. {
    3. QByteArray opacityProp( QString( "windowOpacity" ).toLatin1() );
    4. QPropertyAnimation * pFadeOutAnimation = new QPropertyAnimation( pFadeOut, opacityProp );
    5. QPropertyAnimation * pFadeInAnimation = new QPropertyAnimation( pFadeIn, opacityProp );
    6.  
    7. int duration = 3000;
    8. pFadeOutAnimation->setDuration( duration );
    9. pDafeOutAnimation->setStartValue( 1.0 );
    10. pFadeOutAnimation->setEndValue( 0.0 );
    11.  
    12. // Hide the fade out widget when the animation has stopped
    13. connect( pFadeOutAnimation, &QPropertyAnimation::finished, pFadeOut, &QWidget::hide );
    14.  
    15. pFadeInAnimation->setDuration( duration );
    16. pFadeInAnimation->setStartValue( 0.0 );
    17. pFadeInAnimation->setEndValue( 1.0 );
    18.  
    19. // Ensure the fade in widget is showing, but make it invisible by setting opacity to 0
    20. if ( !pFadeIn->isVisible() )
    21. {
    22. pFadeIn->setWindowOpacity( 0.0 );
    23. pFadeIn->show();
    24. }
    25.  
    26. pFadeOutAnimation->start( QAbstractAnimation::DeleteWhenStopped );
    27. pFadeInAnimation->start( QAbstractAnimation::DeleteWhenStopped );
    28. }
    To copy to clipboard, switch view to plain text mode 

    Not tested, so may require some edits.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. #4
    Join Date
    Nov 2016
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Load new view (.ui) from the previous view

    Thanks so much. Its works beautifully. You are a savior

Similar Threads

  1. Replies: 5
    Last Post: 2nd June 2016, 08:42
  2. Building Tree view from Table view which is already build.
    By DURGAPRASAD NEELAM in forum Newbie
    Replies: 6
    Last Post: 18th May 2015, 07:18
  3. view return stored procedure in table view
    By baradar in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2014, 19:24
  4. How to switch view in sliding/moving new view from right of device to the left
    By curiouswalker in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 16th November 2010, 11:55
  5. Replies: 5
    Last Post: 21st November 2007, 20:38

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.