Commit f9aa95ce authored by Eike Ziller's avatar Eike Ziller

Editors: Support dragging from file system view to splits

Change-Id: I17d08fa3cf018f036f88f6be027e4c3740e90f74
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 686bce16
......@@ -75,6 +75,7 @@ public:
explicit DotRemovalFilter(QObject *parent = 0);
protected:
virtual bool filterAcceptsRow(int source_row, const QModelIndex &parent) const;
Qt::DropActions supportedDragActions() const;
};
DotRemovalFilter::DotRemovalFilter(QObject *parent) : QSortFilterProxyModel(parent)
......@@ -90,12 +91,18 @@ bool DotRemovalFilter::filterAcceptsRow(int source_row, const QModelIndex &paren
return fileName != QLatin1String(".");
}
Qt::DropActions DotRemovalFilter::supportedDragActions() const
{
return sourceModel()->supportedDragActions();
}
// FolderNavigationModel: Shows path as tooltip.
class FolderNavigationModel : public QFileSystemModel
{
public:
explicit FolderNavigationModel(QObject *parent = 0);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
Qt::DropActions supportedDragActions() const;
};
FolderNavigationModel::FolderNavigationModel(QObject *parent) :
......@@ -111,6 +118,11 @@ QVariant FolderNavigationModel::data(const QModelIndex &index, int role) const
return QFileSystemModel::data(index, role);
}
Qt::DropActions FolderNavigationModel::supportedDragActions() const
{
return Qt::MoveAction;
}
/*!
\class FolderNavigationWidget
......@@ -141,6 +153,8 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent)
m_listView->setModel(m_filterModel);
m_listView->setFrameStyle(QFrame::NoFrame);
m_listView->setAttribute(Qt::WA_MacShowFocusRect, false);
m_listView->setDragEnabled(true);
m_listView->setDragDropMode(QAbstractItemView::DragOnly);
setFocusProxy(m_listView);
QVBoxLayout *layout = new QVBoxLayout();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment