Important: Please read the Qt Code of Conduct -

QTableView drag/drop question

  • Hi,

    I have a QTableView with a subclassed model. The QTableView has 1 visible column and 2 hidden columns.Everything seems to be working fine except for the drag/drop operation needed to allow users to order the rows. The drag/drop will only move the first column (the visible column). The 2 hidden columns aren't handled. The overloaded model's setData() only gets called with the model index for the visible column. Everything
    works fine if the 2 hidden columns are set to visible.

    I was thinking of just storing all of the data in the first column as a list but then that sort of circumvents using a QTableView in the first place. Should I be overloading the QAbstractItemModel::dropMimeData or try something else?

    thanks in advance.

  • Did you set the selection behavior to rows? setSelectionBehavior(QAbstractItemView::SelectRows)

  • Yes, the selection behavior is set to select rows. The row(s) do move in entirety when the columns are visible.

  • This sounds like a bug, then, I would say. You can publish it in the bug tracker:

Log in to reply