I am trying to implement a drag and drop function between rows of a QTableView
. I am using this source as guideline for the implementation. However I have some problems when implementing dropMimeData
to extend the drag and drop to the entire QTableView
but there is a non static member function without an object argument error.
Here the part of the code that is throwing the error and that I am not sure how to take care:
tablemodel.h
class TableModel : public QAbstractListModel
{
Q_OBJECT
public:
TableModel();
// additional functions....
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent);
private:
QList<QStringList> m_data;
};
tablemodel.cpp
bool TableModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
Q_UNUSED(parent);
Q_UNUSED(column);
if(row == -1) {
row = rowCount();
}
return QAbstractTableModel::dropMimeData(data, action, row, 0, parent); // <-- Error here
}
on the line return QAbstractTableModel::dropMimeData(data, action, row, 0, parent);
the compiler throws the error of:
call to non-static member function without an object argumenmt
Thank you for shedding light on this problem
Aucun commentaire:
Enregistrer un commentaire