(#467) Drag & drop improvements. Keeping track of the items being dragged.

This commit is contained in:
Pål Hagen
2015-10-21 17:21:56 +02:00
parent f4bbbcb7a2
commit 6747fe5976
2 changed files with 158 additions and 40 deletions

View File

@@ -20,16 +20,20 @@
#pragma once
#include "cafPdmUiDragDropHandle.h"
#include "cafPdmPointer.h"
#include "cafPdmObjectGroup.h"
#include <vector>
namespace caf
{
class PdmObjectHandle;
}
class RimIdenticalGridCaseGroup;
class RimWellLogPlotTrack;
class RimWellLogPlot;
namespace caf
{
class PdmObjectGroup;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -44,11 +48,18 @@ public:
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual QMimeData* mimeData(const QModelIndexList &indexes) const;
virtual QStringList mimeTypes() const;
virtual void endDrag();
private:
void moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
bool handleGridCaseGroupDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
bool handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlotTrack* wellLogPlotTrack);
bool handleWellLogPlotDrop(Qt::DropAction action, caf::PdmObjectGroup& objectGroup, RimWellLogPlot* wellLogPlot);
static void objectGroupFromModelIndexes(caf::PdmObjectGroup* objectGroup, const QModelIndexList &indexes);
static std::vector<caf::PdmPointer<caf::PdmObjectHandle> > objectHandles(const QModelIndexList &indexes);
private:
mutable std::vector<caf::PdmPointer<caf::PdmObjectHandle> > m_dragItems;
};