mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-10 15:36:09 -06:00
System : Renamed classes and function names relaed to drag and drop
This commit is contained in:
parent
d2b5d7ae92
commit
5a1e244b2a
@ -105,7 +105,7 @@ private:
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuDragDrop::RiuDragDrop()
|
RiuDragDrop::RiuDragDrop()
|
||||||
{
|
{
|
||||||
m_proposedAction = Qt::MoveAction;
|
m_proposedDropAction = Qt::MoveAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -163,7 +163,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
|||||||
itemflags |= Qt::ItemIsDropEnabled;
|
itemflags |= Qt::ItemIsDropEnabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_proposedAction == Qt::MoveAction)
|
else if (m_proposedDropAction == Qt::MoveAction)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
if (dynamic_cast<RimWellLogPlot*>(uiItem))
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ Qt::ItemFlags RiuDragDrop::flags(const QModelIndex &index) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_proposedAction == Qt::CopyAction)
|
else if (m_proposedDropAction == Qt::CopyAction)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<RimWellLogPlotTrack*>(uiItem))
|
if (dynamic_cast<RimWellLogPlotTrack*>(uiItem))
|
||||||
{
|
{
|
||||||
@ -290,7 +290,7 @@ QStringList RiuDragDrop::mimeTypes() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuDragDrop::endDrag()
|
void RiuDragDrop::onDragCanceled()
|
||||||
{
|
{
|
||||||
m_dragItems.clear();
|
m_dragItems.clear();
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ std::vector<caf::PdmPointer<caf::PdmObjectHandle> > RiuDragDrop::objectHandlesFr
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiuDragDrop::setProposedAction(Qt::DropAction action)
|
void RiuDragDrop::onProposedDropActionUpdated(Qt::DropAction action)
|
||||||
{
|
{
|
||||||
m_proposedAction = action;
|
m_proposedDropAction = action;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cafPdmUiDragDropHandle.h"
|
#include "cafPdmUiDragDropInterface.h"
|
||||||
#include "cafPdmPointer.h"
|
#include "cafPdmPointer.h"
|
||||||
#include "cafPdmObjectGroup.h"
|
#include "cafPdmObjectGroup.h"
|
||||||
|
|
||||||
@ -38,19 +38,21 @@ class RimWellLogPlotCurve;
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
class RiuDragDrop : public caf::PdmUiDragDropHandle
|
class RiuDragDrop : public caf::PdmUiDragDropInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RiuDragDrop();
|
RiuDragDrop();
|
||||||
virtual ~RiuDragDrop();
|
virtual ~RiuDragDrop();
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual Qt::DropActions supportedDropActions() const;
|
virtual Qt::DropActions supportedDropActions() const;
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||||||
virtual QMimeData* mimeData(const QModelIndexList &indexes) const;
|
virtual QMimeData* mimeData(const QModelIndexList &indexes) const;
|
||||||
virtual QStringList mimeTypes() const;
|
virtual QStringList mimeTypes() const;
|
||||||
virtual void endDrag();
|
|
||||||
virtual void setProposedAction(Qt::DropAction action);
|
virtual void onDragCanceled();
|
||||||
|
virtual void onProposedDropActionUpdated(Qt::DropAction action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
|
void moveCasesToGridGroup(caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup);
|
||||||
@ -64,6 +66,6 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<caf::PdmPointer<caf::PdmObjectHandle> > m_dragItems;
|
mutable std::vector<caf::PdmPointer<caf::PdmObjectHandle> > m_dragItems;
|
||||||
Qt::DropAction m_proposedAction;
|
Qt::DropAction m_proposedDropAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
|
|
||||||
sm_mainWindowInstance = this;
|
sm_mainWindowInstance = this;
|
||||||
|
|
||||||
m_dragDrop = new RiuDragDrop;
|
m_dragDropInterface = new RiuDragDrop;
|
||||||
|
|
||||||
initializeGuiNewProjectLoaded();
|
initializeGuiNewProjectLoaded();
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_dragDrop;
|
delete m_dragDropInterface;
|
||||||
|
|
||||||
saveWinGeoAndDockToolBarLayout();
|
saveWinGeoAndDockToolBarLayout();
|
||||||
|
|
||||||
@ -1319,7 +1319,7 @@ void RiuMainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
|
|||||||
|
|
||||||
m_projectTreeView->setPdmItem(pdmRoot);
|
m_projectTreeView->setPdmItem(pdmRoot);
|
||||||
// For debug only : m_projectTreeView->treeView()->expandAll();
|
// For debug only : m_projectTreeView->treeView()->expandAll();
|
||||||
m_projectTreeView->setDragDropHandle(m_dragDrop);
|
m_projectTreeView->setDragDropInterface(m_dragDropInterface);
|
||||||
|
|
||||||
for (size_t i = 0; i < additionalProjectViews.size(); i++)
|
for (size_t i = 0; i < additionalProjectViews.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ namespace caf
|
|||||||
class UiPropertyCreatorPdm;
|
class UiPropertyCreatorPdm;
|
||||||
class UiTreeModelPdm;
|
class UiTreeModelPdm;
|
||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmUiDragDropHandle;
|
class PdmUiDragDropInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ssihub
|
namespace ssihub
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
caf::PdmUiTreeView* m_projectTreeView;
|
caf::PdmUiTreeView* m_projectTreeView;
|
||||||
|
|
||||||
caf::PdmUiDragDropHandle* m_dragDrop;
|
caf::PdmUiDragDropInterface* m_dragDropInterface;
|
||||||
|
|
||||||
QUndoView* m_undoView;
|
QUndoView* m_undoView;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ set( PROJECT_FILES
|
|||||||
cafPdmUiComboBoxEditor.h
|
cafPdmUiComboBoxEditor.h
|
||||||
cafPdmUiDoubleSliderEditor.cpp
|
cafPdmUiDoubleSliderEditor.cpp
|
||||||
cafPdmUiDoubleSliderEditor.h
|
cafPdmUiDoubleSliderEditor.h
|
||||||
cafPdmUiDragDropHandle.h
|
cafPdmUiDragDropInterface.h
|
||||||
cafPdmUiFilePathEditor.cpp
|
cafPdmUiFilePathEditor.cpp
|
||||||
cafPdmUiFilePathEditor.h
|
cafPdmUiFilePathEditor.h
|
||||||
cafPdmUiLineEditor.cpp
|
cafPdmUiLineEditor.cpp
|
||||||
|
@ -47,20 +47,28 @@ namespace caf
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
class PdmUiDragDropHandle
|
class PdmUiDragDropInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~PdmUiDragDropHandle() = 0;
|
virtual ~PdmUiDragDropInterface() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
friend class PdmUiTreeViewModel;
|
||||||
|
friend class PdmUiTreeViewWidget;
|
||||||
|
|
||||||
|
// Forwarding from Qt functions in QAbstractItemModel
|
||||||
virtual Qt::DropActions supportedDropActions() const = 0;
|
virtual Qt::DropActions supportedDropActions() const = 0;
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const = 0;
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const = 0;
|
||||||
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) = 0;
|
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) = 0;
|
||||||
virtual QMimeData* mimeData(const QModelIndexList &indexes) const = 0;
|
virtual QMimeData* mimeData(const QModelIndexList &indexes) const = 0;
|
||||||
virtual QStringList mimeTypes() const = 0;
|
virtual QStringList mimeTypes() const = 0;
|
||||||
virtual void endDrag() = 0;
|
|
||||||
virtual void setProposedAction(Qt::DropAction action) = 0;
|
// Forwarding of tree view events
|
||||||
|
virtual void onDragCanceled() = 0;
|
||||||
|
virtual void onProposedDropActionUpdated(Qt::DropAction action) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline PdmUiDragDropHandle::~PdmUiDragDropHandle() { }
|
inline PdmUiDragDropInterface::~PdmUiDragDropInterface() { }
|
||||||
|
|
||||||
} // end namespace caf
|
} // end namespace caf
|
@ -190,9 +190,9 @@ QModelIndex PdmUiTreeView::findModelIndex(const PdmUiItem* object) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTreeView::setDragDropHandle(PdmUiDragDropHandle* dragDropHandle)
|
void PdmUiTreeView::setDragDropInterface(PdmUiDragDropInterface* dragDropInterface)
|
||||||
{
|
{
|
||||||
m_treeViewEditor->setDragDropHandle(dragDropHandle);
|
m_treeViewEditor->setDragDropInterface(dragDropInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -50,7 +50,7 @@ namespace caf
|
|||||||
|
|
||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmUiTreeViewEditor;
|
class PdmUiTreeViewEditor;
|
||||||
class PdmUiDragDropHandle;
|
class PdmUiDragDropInterface;
|
||||||
class PdmObjectHandle;
|
class PdmObjectHandle;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
||||||
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
||||||
|
|
||||||
void setDragDropHandle(PdmUiDragDropHandle* dragDropHandle);
|
void setDragDropInterface(PdmUiDragDropInterface* dragDropInterface);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
|
@ -39,23 +39,59 @@
|
|||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmUiEditorHandle.h"
|
|
||||||
#include "cafPdmUiCommandSystemProxy.h"
|
#include "cafPdmUiCommandSystemProxy.h"
|
||||||
|
#include "cafPdmUiDragDropInterface.h"
|
||||||
|
#include "cafPdmUiEditorHandle.h"
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiTreeViewModel.h"
|
#include "cafPdmUiTreeViewModel.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include <QDragMoveEvent>
|
||||||
|
#include <QEvent>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QModelIndexList>
|
#include <QModelIndexList>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
namespace caf
|
namespace caf
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
class PdmUiTreeViewWidget : public QTreeView
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PdmUiTreeViewWidget(QWidget* parent = 0) : QTreeView(parent) {};
|
||||||
|
virtual ~PdmUiTreeViewWidget() {};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void dragMoveEvent(QDragMoveEvent* event)
|
||||||
|
{
|
||||||
|
caf::PdmUiTreeViewModel* treeViewModel = dynamic_cast<caf::PdmUiTreeViewModel*>(model());
|
||||||
|
if (treeViewModel && treeViewModel->dragDropInterface())
|
||||||
|
{
|
||||||
|
treeViewModel->dragDropInterface()->onProposedDropActionUpdated(event->proposedAction());
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::dragMoveEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void dragLeaveEvent(QDragLeaveEvent* event)
|
||||||
|
{
|
||||||
|
caf::PdmUiTreeViewModel* treeViewModel = dynamic_cast<caf::PdmUiTreeViewModel*>(model());
|
||||||
|
if (treeViewModel && treeViewModel->dragDropInterface())
|
||||||
|
{
|
||||||
|
treeViewModel->dragDropInterface()->onDragCanceled();
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView::dragLeaveEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -291,9 +327,9 @@ QModelIndex PdmUiTreeViewEditor::findModelIndex(const PdmUiItem* object) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTreeViewEditor::setDragDropHandle(PdmUiDragDropHandle* dragDropHandle)
|
void PdmUiTreeViewEditor::setDragDropInterface(PdmUiDragDropInterface* dragDropInterface)
|
||||||
{
|
{
|
||||||
m_treeViewModel->setDragDropHandle(dragDropHandle);
|
m_treeViewModel->setDragDropInterface(dragDropInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -61,7 +61,7 @@ namespace caf
|
|||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmUiTreeViewModel;
|
class PdmUiTreeViewModel;
|
||||||
class PdmChildArrayFieldHandle;
|
class PdmChildArrayFieldHandle;
|
||||||
class PdmUiDragDropHandle;
|
class PdmUiDragDropInterface;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -77,38 +77,6 @@ public:
|
|||||||
QStringList columnHeaders;
|
QStringList columnHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
class PdmUiTreeViewWidget : public QTreeView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PdmUiTreeViewWidget(QWidget* parent = 0) : QTreeView(parent) {};
|
|
||||||
virtual ~PdmUiTreeViewWidget() {};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void dragMoveEvent(QDragMoveEvent* event)
|
|
||||||
{
|
|
||||||
caf::PdmUiTreeViewModel* treeViewModel = dynamic_cast<caf::PdmUiTreeViewModel*>(model());
|
|
||||||
if (treeViewModel)
|
|
||||||
{
|
|
||||||
treeViewModel->updateDragDropHandleFromEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
QTreeView::dragMoveEvent(event);
|
|
||||||
}
|
|
||||||
virtual void dragLeaveEvent(QDragLeaveEvent* event)
|
|
||||||
{
|
|
||||||
caf::PdmUiTreeViewModel* treeViewModel = dynamic_cast<caf::PdmUiTreeViewModel*>(model());
|
|
||||||
if (treeViewModel)
|
|
||||||
{
|
|
||||||
treeViewModel->endDrag();
|
|
||||||
}
|
|
||||||
|
|
||||||
QTreeView::dragLeaveEvent(event);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -136,7 +104,7 @@ public:
|
|||||||
|
|
||||||
QWidget* createWidget(QWidget* parent);
|
QWidget* createWidget(QWidget* parent);
|
||||||
|
|
||||||
void setDragDropHandle(PdmUiDragDropHandle* dragDropHandle);
|
void setDragDropInterface(PdmUiDragDropInterface* dragDropInterface);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
@ -165,7 +133,7 @@ private:
|
|||||||
QPointer<QWidget> m_mainWidget;
|
QPointer<QWidget> m_mainWidget;
|
||||||
QVBoxLayout* m_layout;
|
QVBoxLayout* m_layout;
|
||||||
|
|
||||||
PdmUiTreeViewWidget* m_treeView;
|
QTreeView* m_treeView;
|
||||||
PdmUiTreeViewModel* m_treeViewModel;
|
PdmUiTreeViewModel* m_treeViewModel;
|
||||||
|
|
||||||
PdmUiTreeViewEditorAttribute m_editorAttributes;
|
PdmUiTreeViewEditorAttribute m_editorAttributes;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
#include "cafPdmUiDragDropHandle.h"
|
#include "cafPdmUiDragDropInterface.h"
|
||||||
#include "cafPdmUiTreeItemEditor.h"
|
#include "cafPdmUiTreeItemEditor.h"
|
||||||
#include "cafPdmUiTreeOrdering.h"
|
#include "cafPdmUiTreeOrdering.h"
|
||||||
#include "cafPdmUiTreeViewEditor.h"
|
#include "cafPdmUiTreeViewEditor.h"
|
||||||
@ -56,7 +56,7 @@ namespace caf
|
|||||||
PdmUiTreeViewModel::PdmUiTreeViewModel(PdmUiTreeViewEditor* treeViewEditor)
|
PdmUiTreeViewModel::PdmUiTreeViewModel(PdmUiTreeViewEditor* treeViewEditor)
|
||||||
{
|
{
|
||||||
m_treeOrderingRoot = NULL;
|
m_treeOrderingRoot = NULL;
|
||||||
m_dragDropHandle = NULL;
|
m_dragDropInterface = NULL;
|
||||||
|
|
||||||
m_treeViewEditor = treeViewEditor;
|
m_treeViewEditor = treeViewEditor;
|
||||||
}
|
}
|
||||||
@ -747,9 +747,9 @@ Qt::ItemFlags PdmUiTreeViewModel::flags(const QModelIndex &index) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dragDropHandle)
|
if (m_dragDropInterface)
|
||||||
{
|
{
|
||||||
Qt::ItemFlags dragDropFlags = m_dragDropHandle->flags(index);
|
Qt::ItemFlags dragDropFlags = m_dragDropInterface->flags(index);
|
||||||
flagMask |= dragDropFlags;
|
flagMask |= dragDropFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,31 +790,17 @@ PdmUiItem* PdmUiTreeViewModel::uiItemFromModelIndex(const QModelIndex& index) co
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTreeViewModel::setDragDropHandle(PdmUiDragDropHandle* dragDropHandle)
|
void PdmUiTreeViewModel::setDragDropInterface(PdmUiDragDropInterface* dragDropInterface)
|
||||||
{
|
{
|
||||||
m_dragDropHandle = dragDropHandle;
|
m_dragDropInterface = dragDropInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void PdmUiTreeViewModel::updateDragDropHandleFromEvent(const QDragMoveEvent* event)
|
PdmUiDragDropInterface* PdmUiTreeViewModel::dragDropInterface()
|
||||||
{
|
{
|
||||||
if (m_dragDropHandle && event)
|
return m_dragDropInterface;
|
||||||
{
|
|
||||||
m_dragDropHandle->setProposedAction(event->proposedAction());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void PdmUiTreeViewModel::endDrag()
|
|
||||||
{
|
|
||||||
if (m_dragDropHandle)
|
|
||||||
{
|
|
||||||
m_dragDropHandle->endDrag();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -822,9 +808,9 @@ void PdmUiTreeViewModel::endDrag()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QStringList PdmUiTreeViewModel::mimeTypes() const
|
QStringList PdmUiTreeViewModel::mimeTypes() const
|
||||||
{
|
{
|
||||||
if (m_dragDropHandle)
|
if (m_dragDropInterface)
|
||||||
{
|
{
|
||||||
return m_dragDropHandle->mimeTypes();
|
return m_dragDropInterface->mimeTypes();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -837,9 +823,9 @@ QStringList PdmUiTreeViewModel::mimeTypes() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QMimeData * PdmUiTreeViewModel::mimeData(const QModelIndexList &indexes) const
|
QMimeData * PdmUiTreeViewModel::mimeData(const QModelIndexList &indexes) const
|
||||||
{
|
{
|
||||||
if (m_dragDropHandle)
|
if (m_dragDropInterface)
|
||||||
{
|
{
|
||||||
return m_dragDropHandle->mimeData(indexes);
|
return m_dragDropInterface->mimeData(indexes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -852,9 +838,9 @@ QMimeData * PdmUiTreeViewModel::mimeData(const QModelIndexList &indexes) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool PdmUiTreeViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
bool PdmUiTreeViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
if (m_dragDropHandle)
|
if (m_dragDropInterface)
|
||||||
{
|
{
|
||||||
return m_dragDropHandle->dropMimeData(data, action, row, column, parent);
|
return m_dragDropInterface->dropMimeData(data, action, row, column, parent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -867,9 +853,9 @@ bool PdmUiTreeViewModel::dropMimeData(const QMimeData *data, Qt::DropAction acti
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
Qt::DropActions PdmUiTreeViewModel::supportedDropActions() const
|
Qt::DropActions PdmUiTreeViewModel::supportedDropActions() const
|
||||||
{
|
{
|
||||||
if (m_dragDropHandle)
|
if (m_dragDropInterface)
|
||||||
{
|
{
|
||||||
return m_dragDropHandle->supportedDropActions();
|
return m_dragDropInterface->supportedDropActions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ class PdmObjectHandle;
|
|||||||
class PdmUiItem;
|
class PdmUiItem;
|
||||||
class PdmUiTreeViewEditor;
|
class PdmUiTreeViewEditor;
|
||||||
class PdmUiTreeOrdering;
|
class PdmUiTreeOrdering;
|
||||||
class PdmUiDragDropHandle;
|
class PdmUiDragDropInterface;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
//
|
//
|
||||||
@ -75,9 +75,8 @@ public:
|
|||||||
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
PdmUiItem* uiItemFromModelIndex(const QModelIndex& index) const;
|
||||||
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
QModelIndex findModelIndex(const PdmUiItem* object) const;
|
||||||
|
|
||||||
void setDragDropHandle(PdmUiDragDropHandle* dragDropHandle);
|
void setDragDropInterface(PdmUiDragDropInterface* dragDropInterface);
|
||||||
void updateDragDropHandleFromEvent(const QDragMoveEvent* event);
|
PdmUiDragDropInterface* dragDropInterface();
|
||||||
void endDrag();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateSubTreeRecursive(const QModelIndex& uiSubTreeRootModelIdx, PdmUiTreeOrdering* uiModelSubTreeRoot, PdmUiTreeOrdering* updatedPdmSubTreeRoot);
|
void updateSubTreeRecursive(const QModelIndex& uiSubTreeRootModelIdx, PdmUiTreeOrdering* uiModelSubTreeRoot, PdmUiTreeOrdering* updatedPdmSubTreeRoot);
|
||||||
@ -95,7 +94,7 @@ private:
|
|||||||
|
|
||||||
PdmUiTreeViewEditor* m_treeViewEditor;
|
PdmUiTreeViewEditor* m_treeViewEditor;
|
||||||
|
|
||||||
PdmUiDragDropHandle* m_dragDropHandle;
|
PdmUiDragDropInterface* m_dragDropInterface;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user