Adapt to setSupportedDragActions() begin removed.

Models have a virtual supportedDragActions() now.
This commit is contained in:
Felix Geyer 2015-07-22 17:03:36 +02:00
parent 5a745da07b
commit e3cde7b55e
5 changed files with 12 additions and 2 deletions

View File

@ -22,6 +22,11 @@ SortFilterHideProxyModel::SortFilterHideProxyModel(QObject* parent)
{
}
Qt::DropActions SortFilterHideProxyModel::supportedDragActions() const
{
return sourceModel()->supportedDragActions();
}
void SortFilterHideProxyModel::hideColumn(int column, bool hide)
{
m_hiddenColumns.resize(column + 1);

View File

@ -29,6 +29,7 @@ class SortFilterHideProxyModel : public QSortFilterProxyModel
public:
explicit SortFilterHideProxyModel(QObject* parent = Q_NULLPTR);
Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE;
void hideColumn(int column, bool hide);
protected:

View File

@ -29,7 +29,6 @@ EntryModel::EntryModel(QObject* parent)
: QAbstractTableModel(parent)
, m_group(Q_NULLPTR)
{
setSupportedDragActions(Qt::MoveAction | Qt::CopyAction);
}
Entry* EntryModel::entryFromIndex(const QModelIndex& index) const
@ -191,6 +190,11 @@ Qt::DropActions EntryModel::supportedDropActions() const
return 0;
}
Qt::DropActions EntryModel::supportedDragActions() const
{
return (Qt::MoveAction | Qt::CopyAction);
}
Qt::ItemFlags EntryModel::flags(const QModelIndex& modelIndex) const
{
if (!modelIndex.isValid()) {

View File

@ -47,6 +47,7 @@ public:
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE;
Qt::ItemFlags flags(const QModelIndex& modelIndex) const Q_DECL_OVERRIDE;
QStringList mimeTypes() const Q_DECL_OVERRIDE;
QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE;

View File

@ -32,7 +32,6 @@ EntryView::EntryView(QWidget* parent)
m_sortModel->setDynamicSortFilter(true);
m_sortModel->setSortLocaleAware(true);
m_sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
m_sortModel->setSupportedDragActions(m_model->supportedDragActions());
QTreeView::setModel(m_sortModel);
setUniformRowHeights(true);