well, without your code... just a guess. Do you check roles in headerData()?
well, without your code... just a guess. Do you check roles in headerData()?
smacchia (19th October 2009)
I assume your setting columnCount? Heres a snippet from my model that works:
Qt Code:
{ Q_UNUSED(parent); return 2; } { if (role != Qt::DisplayRole) if (orientation == Qt::Horizontal) { switch (section) { case 0: return tr("Id"); case 1: return tr("Description"); default: return "Unknown!"; } } }To copy to clipboard, switch view to plain text mode
smacchia (19th October 2009)
Yes I had ::columnCount and ::headerData. But, I was missing the following from ::headerData
Qt Code:
if (role != Qt::DisplayRole)To copy to clipboard, switch view to plain text mode
Silly mistake on my part. But you're reply helped me figure out what was missing. The headers are showing up with this snippet in place
thanks!
Hi, thanks for your post. I have the same situation. But I wanna hide the column header. I tried many ways, but there's still an empty header (row 0). I can remove all headers or just row header (column 0) like you do. Could you help me out? Thanks in advance.
Hi, could anybody please help me create a table without row-header (row 0). It'd look like this:
Row1|data-1|data-2
Row2|data-3|data-3
data-x is editable while Row1/row2 is not (it's header-like). I tried many ways but still not able to do so.
Thanks.
Have you tried view->horizontalHeader()->hide() or is that not what your looking for?
rockballad (20th November 2009)
Bookmarks