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.
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.
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).
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).
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.
this is a image of the application, the column "CODIGO" it is where the bar code reader inserts the codes.
Bookmarks