PDA

View Full Version : QSqlRelationalDelegate Combobox not submitting & setRelation limits



Palsy
12th April 2017, 11:53
Hello,

There are a couple of issues I am having with QSqlRelationalDelegate, using a QTableView:

1) setRelation-> only works up to 15 items. Any more than this causes either a freeze when selecting the model, or the relation delegate do not display. Is this by design or is there anything I could do about this?

2) When I've set relation for a large number of items (> 256), the combobox editing is very hit and miss. After around index 257, the combobox current index resets to 0 when I've changed it to a larger number, and then the data isn't sent back to the model.

From what I can tell, these comboboxes are lazy loading, so I'm wondering whether that may be an issue. Can I make it load all of the items immediately when the user opens the edit mode?

I'm trying to understand the problem more and whether I need to reconsider the editing part. I do not have any control over the relation data, it is impossible for me change that.

At the moment I think I have a couple of options:-

1) Push the user to a form editor for editing these records when they want to edit these items if they enter a double click or edit event on these columns.
2) Disable the Item Delegate for columns with relation indexes that are too large, and/or provide the user with the raw, non-relational view of these columns.

Am I just wondering, am I trying to do too much with the setRelation? What options might I have to work around this?