QCombobox in a QTable header label
-
-
@VRonin thank you very much but that doesn't answer my question. I can do what's there. That's about setting currentText of a combobox.
What I am talking about here is when the combobox is a child of a qtable header label, not a label of the table and not a parameter of the database. It relies on one of the labels of the table which in my case is stock type.
-
@CEO said in QCombobox in a QTable header label:
I can do what's there
But you are not doing it. You are using
setCellWidget
that does not store the data back in the original cell, you should be using a delegate like the one shown in the linked wiki article. -
@VRonin thanks for your time and contribution. I have fixed it.
The fault lies in the conditional statement I set in the "if widgetitem and widgetitem.text() ..."fieldthat else: I changed it to:
else:
rowdata.append(combobox.currentText())Although I tried that yesterday but it gave me an error. Probably I didn't do one or two things right here.
Anyway, thanks for the time.
Lest I forget, don't you think it would be more appropriately to look through someone's code to see the line one could be making mistake and advising instead of just directing one to a llink of long lectures?
Remember, someone who decides to come here to ask questions must have tried lot of things in a bid to resolve issues. It would be ideal if you guys learn or agree to be going through codes and pointing the lines that needs to be worked on as it's done in Stackoverflow, otherwise there's no need sharing codes here.
Once again, thanks for the time.
-
@CEO said in QCombobox in a QTable header label:
it would be more appropriately to look through someone's code to see the line one could be making mistake and advising instead of just directing one to a llink of long lectures?
I agree totally but I can't write python, I can guess what your program does by reading it but I wouldn't be able to tell you what to chage line-by-line.
I stand on the fact thatsetCellWidget
should not be used in this case. Especially with a db backend as it will slow down to a crawl after a few items are inserted