00001 // $Id: QGo4BrowserTreeWidget.cpp 1134 2014-01-22 14:53:40Z linev $ 00002 //----------------------------------------------------------------------- 00003 // The GSI Online Offline Object Oriented (Go4) Project 00004 // Experiment Data Processing at EE department, GSI 00005 //----------------------------------------------------------------------- 00006 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH 00007 // Planckstr. 1, 64291 Darmstadt, Germany 00008 // Contact: http://go4.gsi.de 00009 //----------------------------------------------------------------------- 00010 // This software can be used under the license agreements as stated 00011 // in Go4License.txt file which is part of the distribution. 00012 //----------------------------------------------------------------------- 00013 00014 #include "QGo4BrowserTreeWidget.h" 00015 00016 #include <QDropEvent> 00017 #include <QDrag> 00018 00019 QGo4BrowserTreeWidget::QGo4BrowserTreeWidget(QWidget* parent) : 00020 QTreeWidget(parent) 00021 { 00022 } 00023 00024 QGo4BrowserTreeWidget::~QGo4BrowserTreeWidget() 00025 { 00026 } 00027 00028 QStringList QGo4BrowserTreeWidget::mimeTypes () const 00029 { 00030 QStringList qstrList; 00031 qstrList.append("text"); 00032 return qstrList; 00033 } 00034 00035 Qt::DropActions QGo4BrowserTreeWidget::supportedDropActions () const 00036 { 00037 // returns what actions are supported when dropping 00038 return Qt::CopyAction | Qt::MoveAction; 00039 } 00040 00041 bool QGo4BrowserTreeWidget::dropMimeData(QTreeWidgetItem *item, int, const QMimeData *data, Qt::DropAction) 00042 { 00043 emit ItemDropProcess((void*)item, (void*)data); 00044 00045 return true; 00046 } 00047 00048 void QGo4BrowserTreeWidget::mouseMoveEvent(QMouseEvent *event) 00049 { 00050 // if not left button - return 00051 if (event->buttons() & Qt::LeftButton) { 00052 QDrag *drag = 0; 00053 // request from browser drag 00054 emit RequestDragObject(&drag); 00055 00056 if (drag) 00057 drag->start(Qt::CopyAction | Qt::MoveAction); 00058 } 00059 }