Sep-27-2022, 09:31 AM
I have subclassed QStyledItemDelegate, reimplemented initStyleOption and set it to a QTableView. Everything works as expected, but I don't understand something. I noticed that on launch of the GUI, the initStyleOption runs 3 full times for one view, however, the
By printing to console, I noticed that when the GUI loads, initStyleOption gets called once per row in view, then once per item in the view, then again once per item in the view. Is this normal behavior? I'm refraining from sharing code for a couple of reasons, including the code works, and it's a multi-module project and would take a little effort to extract the relevant snippets. I can and will, however, if it helps someone diagnose the "issue" (if it is an issue).
Thanks for any insight.
__init__
method runs once, as I assumed initStyleOption would (per item in the view/model, of course). Why does it do that? By printing to console, I noticed that when the GUI loads, initStyleOption gets called once per row in view, then once per item in the view, then again once per item in the view. Is this normal behavior? I'm refraining from sharing code for a couple of reasons, including the code works, and it's a multi-module project and would take a little effort to extract the relevant snippets. I can and will, however, if it helps someone diagnose the "issue" (if it is an issue).
Thanks for any insight.