forked from qt-creator/qt-creator
Class view: Add drag & drop onto editor splits
Change-Id: I35bc03d4e963500a7edf37d6f9d0ddd0a6c68529 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "classviewutils.h"
|
||||
|
||||
#include <cplusplus/Icons.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace ClassView {
|
||||
namespace Internal {
|
||||
@@ -133,6 +134,35 @@ bool TreeItemModel::hasChildren(const QModelIndex &parent) const
|
||||
return Manager::instance()->hasChildren(itemFromIndex(parent));
|
||||
}
|
||||
|
||||
Qt::DropActions TreeItemModel::supportedDragActions() const
|
||||
{
|
||||
return Qt::MoveAction | Qt::CopyAction;
|
||||
}
|
||||
|
||||
QStringList TreeItemModel::mimeTypes() const
|
||||
{
|
||||
return ::Utils::FileDropSupport::mimeTypesForFilePaths();
|
||||
}
|
||||
|
||||
QMimeData *TreeItemModel::mimeData(const QModelIndexList &indexes) const
|
||||
{
|
||||
auto mimeData = new ::Utils::FileDropMimeData;
|
||||
mimeData->setOverrideFileDropAction(Qt::CopyAction);
|
||||
foreach (const QModelIndex &index, indexes) {
|
||||
const QSet<SymbolLocation> locations = Utils::roleToLocations(
|
||||
data(index, Constants::SymbolLocationsRole).toList());
|
||||
if (locations.isEmpty())
|
||||
continue;
|
||||
const SymbolLocation loc = *locations.constBegin();
|
||||
mimeData->addFile(loc.fileName(), loc.line(), loc.column());
|
||||
}
|
||||
if (mimeData->files().isEmpty()) {
|
||||
delete mimeData;
|
||||
return 0;
|
||||
}
|
||||
return mimeData;
|
||||
}
|
||||
|
||||
/*!
|
||||
Moves the root item to the \a target item.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user