#include <cpPipelineEditor/Canvas.h>
+#include <QDragEnterEvent>
+#include <QTreeWidget>
+
// -------------------------------------------------------------------------
cpPipelineEditor::Canvas::
Canvas( QWidget* parent )
{
}
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Canvas::
+dragEnterEvent( QDragEnterEvent* event )
+{
+ const QMimeData* mime = event->mimeData( );
+ if( mime->hasFormat( "application/x-qabstractitemmodeldatalist" ) )
+ event->acceptProposedAction( );
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Canvas::
+dragLeaveEvent( QDragLeaveEvent* event )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Canvas::
+dragMoveEvent( QDragMoveEvent* event )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPipelineEditor::Canvas::
+dropEvent( QDropEvent* event )
+{
+ // Get dropped data
+ const QMimeData* mime = event->mimeData( );
+ if( !( mime->hasFormat( "application/x-qabstractitemmodeldatalist" ) ) )
+ return;
+ event->acceptProposedAction( );
+ QTreeWidget* tree = dynamic_cast< QTreeWidget* >( event->source( ) );
+ if( tree == NULL )
+ return;
+
+ // Process dropped data
+ QList< QTreeWidgetItem* > items = tree->selectedItems( );
+ for(
+ QList< QTreeWidgetItem* >::const_iterator iIt = items.begin( );
+ iIt != items.end( );
+ ++iIt
+ )
+ {
+ /* TODO
+ auto parent = ( *iIt )->parent( );
+ if( parent != NULL )
+ this->addFilter(
+ parent->text( 0 ).toStdString( ),
+ ( *iIt )->text( 0 ).toStdString( ),
+ p
+ );
+ */
+
+ } // rof
+}
+
// eof - $RCSfile$