I have a table view that uses a custom model along with a custom proxy model (QSortFilterProxyModel). I use the filterAcceptsColumn to hide columns. This all works fine. The problem occurs when I assign a custom delegate (QItemDelegate) to a column and then hide the column. The delegate will appear in the incorrect column after the hide.

for example if I have 3 columns and 2 rows and assign my delegate to the table view like so:
Qt Code:
  1. mTableView->setItemDelegateForColumn(1, new DropDownListDelegate() );
To copy to clipboard, switch view to plain text mode 

I will then have a table that looks like the following (Note that D represents a Delegate Cell and X is just an ordinary cell)

A B C
---------
X D X
X D X

If I hide Column B I get

A C
-----
X D
X D

Note that the delegate is now in column C. How do I prevent this from happening?