mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#467) Implemented drag & drop for moving tracks after drop target track
This commit is contained in:
@@ -105,8 +105,6 @@ Qt::DropActions RiuDragDrop::supportedDropActions() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
||||
{
|
||||
Qt::ItemFlags itemflags = 0;
|
||||
|
||||
if (index.isValid())
|
||||
{
|
||||
caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView();
|
||||
@@ -114,22 +112,25 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
||||
|
||||
if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem) ||
|
||||
dynamic_cast<RimCaseCollection*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlot*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlotTrack*>(uiItem))
|
||||
dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||
{
|
||||
itemflags |= Qt::ItemIsDropEnabled;
|
||||
return Qt::ItemIsDropEnabled;
|
||||
//cvf::Trace::show("");
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimEclipseCase*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlotCurve*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlotTrack*>(uiItem) ||
|
||||
else if (dynamic_cast<RimEclipseCase*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogFileChannel*>(uiItem))
|
||||
{
|
||||
// TODO: Remember to handle reservoir holding the main grid
|
||||
itemflags |= Qt::ItemIsDragEnabled;
|
||||
return Qt::ItemIsDragEnabled;
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlotCurve*>(uiItem) ||
|
||||
dynamic_cast<RimWellLogPlotTrack*>(uiItem))
|
||||
{
|
||||
return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
Qt::ItemFlags itemflags = 0;
|
||||
return itemflags;
|
||||
}
|
||||
|
||||
@@ -269,6 +270,16 @@ bool RiuDragDrop::handleWellLogPlotTrackDrop(Qt::DropAction action, caf::PdmObje
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogPlotTrack*> wellLogPlotTracks = RiuTypedObjectsFromObjectGroupGetter<RimWellLogPlotTrack>::typedObjectsFromGroup(objectGroup);
|
||||
if (wellLogPlotTracks.size() > 0)
|
||||
{
|
||||
if (action == Qt::MoveAction)
|
||||
{
|
||||
RicWellLogPlotTrackFeatureImpl::moveTracks(wellLogPlotTrack, wellLogPlotTracks);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,19 @@ RiuWellLogPlot::~RiuWellLogPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot)
|
||||
void RiuWellLogPlot::addTrackPlot(RiuWellLogTrackPlot* trackPlot)
|
||||
{
|
||||
// Insert the plot to the left of the scroll bar
|
||||
m_layout->insertWidget(m_layout->count() - 1, trackPlot);
|
||||
m_trackPlots.append(trackPlot);
|
||||
insertTrackPlot(trackPlot, m_layout->count() - 1);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index)
|
||||
{
|
||||
m_layout->insertWidget(index, trackPlot);
|
||||
m_trackPlots.append(trackPlot); // insert?
|
||||
|
||||
modifyWidthOfContainingMdiWindow(trackPlot->width());
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ public:
|
||||
|
||||
RimWellLogPlot* ownerPlotDefinition();
|
||||
|
||||
void insertTrackPlot(RiuWellLogTrackPlot* trackPlot);
|
||||
void addTrackPlot(RiuWellLogTrackPlot* trackPlot);
|
||||
void insertTrackPlot(RiuWellLogTrackPlot* trackPlot, size_t index);
|
||||
void removeTrackPlot(RiuWellLogTrackPlot* trackPlot);
|
||||
|
||||
void setDepthRangeAndReplot(double minDepth, double maxDepth);
|
||||
|
||||
Reference in New Issue
Block a user