From e3cde7b55e7e692733321ac1608e8b22e4c00032 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 22 Jul 2015 17:03:36 +0200 Subject: [PATCH] Adapt to setSupportedDragActions() begin removed. Models have a virtual supportedDragActions() now. --- src/gui/SortFilterHideProxyModel.cpp | 5 +++++ src/gui/SortFilterHideProxyModel.h | 1 + src/gui/entry/EntryModel.cpp | 6 +++++- src/gui/entry/EntryModel.h | 1 + src/gui/entry/EntryView.cpp | 1 - 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/SortFilterHideProxyModel.cpp b/src/gui/SortFilterHideProxyModel.cpp index 09023610..0193d959 100644 --- a/src/gui/SortFilterHideProxyModel.cpp +++ b/src/gui/SortFilterHideProxyModel.cpp @@ -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); diff --git a/src/gui/SortFilterHideProxyModel.h b/src/gui/SortFilterHideProxyModel.h index a6f1e712..aa6f6899 100644 --- a/src/gui/SortFilterHideProxyModel.h +++ b/src/gui/SortFilterHideProxyModel.h @@ -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: diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index 7ee1df8f..bad90ba9 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -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()) { diff --git a/src/gui/entry/EntryModel.h b/src/gui/entry/EntryModel.h index 20bcad99..de87fb3f 100644 --- a/src/gui/entry/EntryModel.h +++ b/src/gui/entry/EntryModel.h @@ -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; diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp index cd2c6fba..f23ecebf 100644 --- a/src/gui/entry/EntryView.cpp +++ b/src/gui/entry/EntryView.cpp @@ -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);