Could you set break points in your code using a debugger and check where exactly does you application spin all the time? Alternatively run your application under a profiler (such as callgrind or gprof) and see what takes the most time.
Could you set break points in your code using a debugger and check where exactly does you application spin all the time? Alternatively run your application under a profiler (such as callgrind or gprof) and see what takes the most time.
montylee (17th March 2009)
Check the data function. May be you are consuming time to fetch data...
EDIT: Oops... u are using standardItemModel...so data fetching is also not in your hands...
prob must be somewhere else.. check for events and how you are handling them..
ya i guess the problem is somewhere else as the problem is coming with QStandardItemModel as well. I haven't got time to debug this issue yet, have been busy in other things. Will update this thread when i am able to debug this issue.
My GNU/Linux Blog:
http://funwithlinux.blogspot.com
Aah, i found the cause of the problem. I compiled the program with -pg option and used gprof to check which API was taking all the CPU time.
I found that it was QAbstractItemView::timerEvent(QTimerEvent * event). I wanted the contents of the table rows to scroll so i implemented a timer by subclassing QAbstractItemView::timerEvent(QTimerEvent * event) in my class. But due to this, the CPU usage goes high.
I think i'll use a normal QTimer instead of reimplementing QAbstractItemView::timerEvent(QTimerEvent * event).
Don't know why QAbstractItemView::timerEvent(QTimerEvent * event) is causing this problem though.
My GNU/Linux Blog:
http://funwithlinux.blogspot.com
I don't think using QTimer will help, it's heavier than a timer event. I'd say you should control the interval properly and stop the timer once you reach your goal although I have no idea what you are doing.
actually the timer needs to be active as long as the widget is showing because the contents of the table row needs to be scrolled. I can stop the timer when the widget gets hidden.
But still using a timer shouldn't cause the CPU usage to be so high.
My GNU/Linux Blog:
http://funwithlinux.blogspot.com
Bookmarks