Results 1 to 4 of 4

Thread: emit make process more slowly ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question emit make process more slowly ?

    I want have indicator for my process. So i use a signal for update the progressbar value

    Qt Code:
    1. //header MakanPakeSambal
    2. signals:
    3. updateProgress(qint64, qint64);
    To copy to clipboard, switch view to plain text mode 


    Qt Code:
    1. //code MakanPakeSambal
    2. qDebug() << "Start : " << QTime::currentTime().toString("h:m:s");
    3. qint64 ukuran=_inFileinfo.size();
    4. qint64 i=0;
    5. while(_inFile.getChar(&c))
    6. {
    7. outFile.putChar(c);
    8. emit updateProgress(ukuran, i);
    9. i++;
    10. }
    11. qDebug() << "End : " << QTime::currentTime().toString("h:m:s");
    To copy to clipboard, switch view to plain text mode 


    And I use like this
    Qt Code:
    1. Dialog::Dialog(QWidget *parent) :
    2. QDialog(parent),
    3. ui(new Ui::Dialog)
    4. {
    5. ui->setupUi(this);
    6.  
    7. mps=new MakanPakeSambal();
    8. connect(mps, SIGNAL(updateProgress(qint64,qint64)), this, SLOT(load(qint64, qint64)));
    9. }
    10.  
    11. void Dialog::load(qint64 max, qint64 curr)
    12. {
    13. ui->load->setMaximum(max);
    14. ui->load->setValue(curr);
    15. }
    To copy to clipboard, switch view to plain text mode 

    This is qDebug result without emit signal

    Start : "18:3:28"
    End : "18:3:42"

    And with emit signal

    Start : "18:4:20"
    End : "18:12:15"

    My method for get the progress value is wrong ?

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

    Default Re: emit make process more slowly ?

    You have a busy loop which blocks event processing. When you exit the loop you probably get a flood of updates of the ui->load object.
    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 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: emit make process more slowly ?

    How big is input file ? Remember that every signal cause redrawing progress bar. Try this :
    1. Create two signals. One for setting max value and one for stepping.
    This first emit only one time.

    2. Copy file with blocks not with single character.

  4. #4
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: emit make process more slowly ?

    Quote Originally Posted by Lesiok View Post
    How big is input file ? Remember that every signal cause redrawing progress bar. Try this :
    1. Create two signals. One for setting max value and one for stepping.
    This first emit only one time.

    2. Copy file with blocks not with single character.

    1. Still slow

    2. How to copy file with blocks ? Can you help me for show sample code ?

Similar Threads

  1. Need advice for a best way to make this application
    By frenk_castle in forum Newbie
    Replies: 3
    Last Post: 25th September 2009, 18:55
  2. Replies: 5
    Last Post: 5th November 2007, 10:13
  3. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.