Itemview
-
Is there any way I can have different tableview header for two different view from same model.
I want for one view my header should be a b c but for other i want my header should be x y z. I dont know how to use custom role in Model::headerData(), can any one please give me some clue,
code would be great help -
DerManu: what you are saying might be quite possible, but what I am thinking here is headerData() has one parameter role, I am kind of wondering how can i set custom role so that for one custom role it should return me one set of value and for other it should return other set of value.
I am not sure but I think if I am able to set this role thing I might have my solution, what do you experts say? -
Andre: Okay but without using proxy could there be any way to have different header for two different view from same model?
I see a role paramenter in headerData() but I coiuld not find any way to set that looks like I am missing something, can you guys help? -
[quote author="Immii" date="1341867904"]I am wondering how can i use Qt::userRole here.[/quote]
Not at all.
Why do you make it so difficult for yourself? The proxy method really is the simplest route.
An alternative could be to "just" create your own QHeaderView subclasses and render the headers yourself without using the model at all, but it is a much more complex route than using a trivial proxy model. And no, trying to use a delegate on the header is not going to work either.