Results 1 to 7 of 7

Thread: wait copy picture then show it

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    273
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    42
    Thanked 1 Time in 1 Post

    Default Re: wait copy picture then show it

    Hi wysota,

    Thanks for your answer..

    How could i make that? Have you a example for me?
    Think DigitalGasoline

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

    Default Re: wait copy picture then show it

    Split your code. One part of it should contain operations to be performed before the download is finished. The other (it should be a slot) should contain operations to be started after the download will have finished. Then at the end of the first part you can use QUrlOperator and connect the second part to its finished() signal. When the download is finished, the slot will be called and your code will continue its job.

  3. #3
    Join Date
    Jan 2006
    Posts
    273
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    42
    Thanked 1 Time in 1 Post

    Default Re: wait copy picture then show it

    Hi wysota, i think i have understand now,

    but my function test will never called why?

    Qt Code:
    1. void MainWindow::showPicure()
    2. {
    3. ui.label->clear();
    4. QString src = (ui.listView->currentItem() )->text( 4 );
    5. QFileInfo file(src);
    6. if(file.isReadable() == true)
    7. {
    8.  
    9. Q3UrlOperator *op = new Q3UrlOperator();
    10. QString temp_picture = "c:/temp/temp_album.jpg";
    11. op->copy(src, temp_picture, false, false);
    12. connect(op, SIGNAL(finished()), this, SLOT(test()));
    13. ui.picture_lb->setText("");
    14. }
    15. else
    16. {
    17. ui.picture_lb->setText("No Picture");
    18. ui.label->clear();
    19. }
    20. }
    21. void MainWindow::test()
    22. {
    23. ui.label->setPixmap(QPixmap("c:/temp/temp_album.jpg"));
    24.  
    25. }
    To copy to clipboard, switch view to plain text mode 
    Think DigitalGasoline

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

    Default Re: wait copy picture then show it

    Quote Originally Posted by raphaelf View Post
    but my function test will never called why?
    The signature of the signals is: finished(Q3NetworkOperation*) so it should be something like:
    Qt Code:
    1. connect(op, SIGNAL(finished(Q3NetworkOperation*)), this, SLOT(test()));
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

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

    raphaelf (5th November 2006)

  6. #5
    Join Date
    Jan 2006
    Posts
    273
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    42
    Thanked 1 Time in 1 Post

    Default Re: wait copy picture then show it

    Thanks JPN and Wysota it works
    Think DigitalGasoline

Similar Threads

  1. Replies: 1
    Last Post: 24th June 2006, 11:10

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
  •  
Qt is a trademark of The Qt Company.