Results 1 to 9 of 9

Thread: Application windows lags while loop doing.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Posts
    8
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application windows lags while loop doing.

    Quote Originally Posted by Lykurg View Post
    How did you meassure that?
    Sorry, my mistake ... tasker window was closed by signal/slot.
    Could anyone write code which I should put to my program to destroy this f****** lag ?

    edit:
    Sorry I think that I've understood you wrong.
    What to do with this code?

    Quote Originally Posted by Lykurg View Post
    Qt Code:
    1. AddressBook *tasker = new AddressBook(this);
    To copy to clipboard, switch view to plain text mode 
    Last edited by Wojtek1990; 22nd July 2010 at 22:58.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Application windows lags while loop doing.

    With passing this as parent, you ensure that the allocated memory will be freed. To really "close" you window use window attribute Qt::WA_DeleteOnClose.

  3. The following user says thank you to Lykurg for this useful post:

    Wojtek1990 (23rd July 2010)

  4. #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: Application windows lags while loop doing.

    I think "tasker window was closed but main window of app still lags" means that the tasker window no longer responds to input. This line:
    Qt Code:
    1. while (checkBox()==1) tasker();
    To copy to clipboard, switch view to plain text mode 
    calls tasker() in a loop that never returns to the Qt event loop. The checkbox cannot change and emit clicked() and the window is generally unresponsive unless the event loop is entered.

    You could look at using QTimer to run tasker() regularly and then use the checkbox to start/stop the timer.

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

    Wojtek1990 (23rd July 2010)

  6. #4
    Join Date
    Jul 2010
    Posts
    8
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application windows lags while loop doing.

    Quote Originally Posted by ChrisW67 View Post
    You could look at using QTimer to run tasker() regularly and then use the checkbox to start/stop the timer.
    Okey, but when I've changed it to ...
    Qt Code:
    1. if (checkBox()==1) tasker();
    To copy to clipboard, switch view to plain text mode 
    ... app laggs too, but just just once (tasker is called 1 time)- I would like to definitely destroy this lag. And thanks for advice how to change this loop - I'll read about QTimer - but as I said problem of lag seems not be here.
    Last edited by Wojtek1990; 23rd July 2010 at 12:30.

  7. #5
    Join Date
    Jul 2010
    Posts
    8
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Application windows lags while loop doing.

    Okey, problem solved by using QThread class.
    Thanks for every reply. I've learned a lot from you.

Similar Threads

  1. Replies: 3
    Last Post: 12th July 2010, 06:25
  2. Application won't quit until event loop quits
    By caelestis in forum Qt Programming
    Replies: 6
    Last Post: 11th February 2010, 07:21
  3. Qt plug-in for GLib event loop based application
    By profoX in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2008, 14:27
  4. GLWidget lags behind
    By waveydavey in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2006, 16:18
  5. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55

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.