Results 1 to 3 of 3

Thread: Qt goes slow?

  1. #1
    Join Date
    Mar 2011
    Posts
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt goes slow?

    Hi,

    I'm using a dial to move a robot but the dial doesn't move at the same speed as my mouse so I have some troubles to see a correct movement of the robot (all in a openGL widget).

    It's true that the movement of the robot is preceded of a huge amount of calculations and matrix operations. However, in C++ it shouldn't be a problem.

    Is it possible to have a bottleneck on the signal/slot communication?

    Any other ideas and solutions? Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt goes slow?

    It depends how they are connected I would guess. If they are queued and you emit millions of them, then I would say yes.

    But it sounds like you need an optimiser.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt goes slow?

    Quote Originally Posted by Cucus View Post
    Hi,
    It's true that the movement of the robot is preceded of a huge amount of calculations and matrix operations. However, in C++ it shouldn't be a problem.
    Seems to me that this is the source of your problem. Remember that the mouse move event is sent on even the smallest movement of the mouse. So if you are doing the same huge amount of calculations for each tiny mouse movement, then your app is probably unable to respond to the mouse in real time.

    I would suggest using a variable to keep track of the difference between some "start" mouse or dial position and the "current" mouse position, and only do the calculation and update the robot position when abs( current - start ) > threshold. Then set start = current, and watch some more. You can adjust the threshold so that on a slower processor, the calculations can still keep up with the mouse movement.

    But there will always be a situation in which the user tries to move the mouse too fast, so you could also consider using a timer to avoid doing updates more frequently that is practical.

Similar Threads

  1. QWebView too slow
    By URPradhan in forum Qt Programming
    Replies: 9
    Last Post: 23rd March 2012, 11:13
  2. Slow interface
    By Guilo in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2010, 17:32
  3. Qt Application is slow
    By sosanjay in forum Qt Programming
    Replies: 2
    Last Post: 3rd November 2009, 08:25
  4. QTextTable is slow!
    By Ishmael in forum Newbie
    Replies: 6
    Last Post: 29th September 2009, 20:25
  5. Qt4 designer SLOW - how to fix?
    By hvengel in forum Qt Tools
    Replies: 3
    Last Post: 10th January 2008, 12:07

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.