Selection row doesn't work in qtableview
-
Hi.
I am using qtableview and my own model and own delegator to show some data. I am using the following code to highlight the cell when is selected by the user :
view->setSelectionBehavior(QAbstractItemView::SelectRows);
view->setSelectionMode(QAbstractItemView::SingleSelection);However, it doesn't work. Could you tell me please what I am doing wrong?
Thanks.
-
@medihech said in Selection row doesn't work in qtableview:
I am using the following code to highlight the cell when is selected by the user
It's not clear what you mean by this
my own model
how does the
flags()
method look like in the model? -
To get something similar to this when the user clicks the cell :
The code I sent you before is to highlight the cell:
But it doesn't work either.
I don't if it could be related, but I also reimplemented the paint method of my delegator, not sure if it is the reason I cannot highlight the cell.
Thanks in advance!
-
Hi,
You should show the implementation of your delegate, you are likely not handling the selected state there.
-
Hi.
I am afraid I cannot show the whole implementation unless it is something more specific. Could you tell me please what do you mean with "handling the select state" ? Could you show me an simple example how to handle it ?
Thank you very much for your help. It is very much appreciated.
-
The Star Delegate example shows it.