PDA

View Full Version : Slow problem QTableView



skuda
22nd February 2008, 15:27
Hello,
i have created one pyqt app we are using in my company, it is warehouse application, any fast workers seems to be faster that application because of fast bar code scanners, they are introducing items in a QTableView with an internal QAbstractTableModel subclass and using QItemDelegate, i have made many profiling and fix all the bottlenecks, when they read too fast it is like the return keypress after read the bar code doesnt works, i can see in the lineedit of the cell many ean13 codes ( although after every read the bar code scanner send a return) toguether and it fails to load because it doesnt exist. To me it seems like a qt problem because it doesnt close the editor when receive a return keypressevent and read the next code in the same editor, i have been to get 4 ean13 in the same lineEdit if i try very fast, the machine where i am using the application is a pentium4 1.8 so it should be sufficient to use the app correctly, the cpu usage goes on 40% to the app, 20% to Xorg, anyone has any idea to accelerate this?

skuda
25th February 2008, 15:44
no one can help me on this? any way to accelerate qlineedit inside qitemdelegate? or what can be the problem?

wysota
25th February 2008, 16:33
Could you try to describe your problem again? And remember we don't know what your application does, so try to focus on the technical side.

skuda
25th February 2008, 18:34
well i have a QTableView with 5 columns, the first it is editable, i write the item number id inside the first column and the other are loaded by a sql query inside the model, the problem it is that to write the item number i am using a bar code reader so i can read 2~4 every second, the bar code reader send an return code after every read, i cant load the app now but i will attach some screenshot this night, the bar code are ean13 for example read this in column 1:

6361324116001 <--- complete ean13, return code it is send automatically

load the complete line and create new line and edit the first column other time to load other item. The problem i have it is that when you read too fast you will give anything like this in the qitemdelete qlineedit.

636132411600163613241160016361324116001

it is like the return code has not been sent and where the model execute the query this code does not exist (evidently), i have thought catch every 13 characters and do the work of create the new lines inside the model but i dont like the idea. I am using PyQt but i have profiled the application code and dont seem to be the problem, the problem seems to be in the qlineedit or QitemDelegate, and i am using the direct qt c++ class QItemDelegate without subclass it. When the application fails the cpu usage it is not over 60~75% (40~50 the app, 20~25 Xorg).

wysota
25th February 2008, 18:51
You might want to reimplement the delegate (especially its createEditor method) and apply some extra code on the line edit before you return it, so that it does what you want. For instance you might make sure that when a complete code is read the editor closes itself and jumps to the next row. I can't suggest more now... I'm not sure I understand exactly what you do there (especially that SQL part).

skuda
26th February 2008, 10:28
the sql loads the item columns in a struct with qvariants that it is viewed via data model method, so it loads the table but it is really fast because we have not too much items and are indexed, i could reimplemente delegate and close the editor when 13 characters are set, i can try to do that but i will have to use a checkbox when they need to do manual insert because they have modifiers to units like this:

2*6361324116001

2 units of 6361324116001 item.
when they are doing manual insert they use this modifiers, but with bar code reader if they need to insert two times the same item, they read two times (its faster) so with manual insert i should change the delegate.i will try it.

skuda
26th February 2008, 12:19
this is a image of the application, the column "CODIGO" it is where the bar code reader inserts the codes.