Results 1 to 5 of 5

Thread: QHttp of QT Assistant example

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: QHttp of QT Assistant example

    I think you can see when the download actually starts if you hook to the dataReadProgress signal.
    When you first receive this signal then it means that the first chunk has been donwloaded.

    To display some text I suggest using QTimer.
    I cannot give you an example since I am not sure it would work. Just a draft, maybe:
    Qt Code:
    1. in constructor:
    2. mTimer = new QTimer();
    3. mTimer->setInterval(1000); //1 second;
    4. mStringList << "message1";
    5. mStringList << "message2";
    6. mStringList << "message3";
    7. mStringList << "message4";
    8. connect(mTimer, SIGNAL(timeout()), this, SLOT(cycleMessages()));
    9. connect(downloadButton, SIGNAL(clicked()), mTimer, SLOT(start())); //start the timer when download is pressed
    10.  
    11. this is the timer slot:
    12. void HttpWindow::cycleMessages()
    13. {
    14. int msgIndex = mStringList.indexOf(firstLabel->text());
    15. if(msgIndex < 0 )
    16. msgIndex = 0;
    17. else
    18. msgIndex++;
    19. if(msgIndex >= mStringList.count())
    20. msgIndex = 0;
    21.  
    22. firstLabel->setText(mStringList.at(msgIndex);
    23. }
    24.  
    25. void HttpWindow::updateDataReadProgress(int bytesRead, int totalBytes)
    26. {
    27. ...
    28. mTimer->stop();
    29. }
    To copy to clipboard, switch view to plain text mode 

    So there you will have a label that just displays those 4 messages in a cycle. The message is switched every second.
    When it reaches the end of the list, it starts again from the beginning.

    mTimer is a QTimer* member.
    mStringList is a QStringList member.
    firstLabel is a QLabel* member.



    Make sure to delete the QTimer in the destructor.

    Regards

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

    thomasjoy (3rd August 2007)

  3. #2
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: QHttp of QT Assistant example

    but do tell me it is not be connected as on the download button Http example had put the another signal that is downloadFile() which get started as we click it
    so on one button two slot how we can put??

Similar Threads

  1. From QHttp to QHttp over SSL
    By Nyphel in forum Newbie
    Replies: 1
    Last Post: 3rd July 2007, 10:41
  2. Qt Assistant path
    By aamer4yu in forum Installation and Deployment
    Replies: 3
    Last Post: 1st February 2007, 14:23
  3. Replies: 1
    Last Post: 18th July 2006, 12:06
  4. Qt assistant under linux
    By jochen_r in forum Newbie
    Replies: 8
    Last Post: 10th January 2006, 08:39

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.