0

So I want to prevent some columns from allowing drag & drop Events. I wasn't able to add a eventfilter to those columns. Anyone with an idea how to do that? I have an QTableView filled with a QStandardItemModel and set up for allowing drag & drop.

easysaesch
  • 159
  • 1
  • 14

1 Answers1

0

You can subclass the model an overwrite the method Qt::ItemFlags QAbstractItemModel::flags(const QModelIndex &index) const.

Julian Mayer
  • 121
  • 4
  • I think that would be a good attempt but in my case I activated drag & drop for the header view of the table. So I'm not sure what I would get as a QModelIndex for the header's cells – easysaesch Jul 17 '17 at 06:38
  • So you drag & drop the columns to change their order? I think a small example of your code could be helpful :) – Julian Mayer Jul 18 '17 at 08:10