Results 1 to 5 of 5

Thread: QProgressDialog and QTcpSocket

  1. #1
    Join Date
    Nov 2012
    Posts
    20
    Thanked 1 Time in 1 Post

    Default QProgressDialog and QTcpSocket

    I'd like to have a progress dialog for writing to a TCP socket but I'm unsure as to which QTcpSocket signal to connect to QProgressDialog::setvalue().



    Can anyone help?

    Thanks!

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

    Default Re: QProgressDialog and QTcpSocket

    There is no such signal. You need to keep track of how much you have written to the socket yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QProgressDialog and QTcpSocket

    There's no meaningful measure to be had from a signal AFAICT: no signal carries a cumulative total. When your code writes, update the progress bar however you want.

    Edit: Pipped by wysota.

  4. #4
    Join Date
    Nov 2012
    Posts
    20
    Thanked 1 Time in 1 Post

    Default Re: QProgressDialog and QTcpSocket

    So I would have to do something like dividing my file into appropriately sized chunks,writing each chunk (then wait for waitForBytesWritten signal) and update the progress bar?

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

    Default Re: QProgressDialog and QTcpSocket

    Quote Originally Posted by tom989 View Post
    So I would have to do something like dividing my file into appropriately sized chunks,writing each chunk (then wait for waitForBytesWritten signal) and update the progress bar?
    How and what you write to the socket is meaningless to the problem. You can use QIODevice::bytesWritten() signal to measure how much was really written to the device but keeping track of how much is left (aka what's the total number of bytes) is what you need to do manually.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QTcpSocket and QProgressBar/QProgressDialog
    By nikkadim in forum Qt Programming
    Replies: 8
    Last Post: 20th September 2012, 11:47
  2. QTreeWidget and QProgressDialog?
    By progman in forum Newbie
    Replies: 6
    Last Post: 18th March 2010, 18:05
  3. Need help in QProgressDialog
    By santhoshv84 in forum Qt Programming
    Replies: 3
    Last Post: 12th September 2008, 18:24
  4. QProgressDialog
    By samirg in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2007, 16:37
  5. qprogressDialog
    By mickey in forum Qt Programming
    Replies: 5
    Last Post: 17th July 2006, 14:16

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.