GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QGo4BrowserTreeWidget.cpp
Go to the documentation of this file.
1 // $Id: QGo4BrowserTreeWidget.cpp 1134 2014-01-22 14:53:40Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "QGo4BrowserTreeWidget.h"
15 
16 #include <QDropEvent>
17 #include <QDrag>
18 
20  QTreeWidget(parent)
21 {
22 }
23 
25 {
26 }
27 
29 {
30  QStringList qstrList;
31  qstrList.append("text");
32  return qstrList;
33 }
34 
36 {
37  // returns what actions are supported when dropping
38  return Qt::CopyAction | Qt::MoveAction;
39 }
40 
41 bool QGo4BrowserTreeWidget::dropMimeData(QTreeWidgetItem *item, int, const QMimeData *data, Qt::DropAction)
42 {
43  emit ItemDropProcess((void*)item, (void*)data);
44 
45  return true;
46 }
47 
48 void QGo4BrowserTreeWidget::mouseMoveEvent(QMouseEvent *event)
49 {
50  // if not left button - return
51  if (event->buttons() & Qt::LeftButton) {
52  QDrag *drag = 0;
53  // request from browser drag
54  emit RequestDragObject(&drag);
55 
56  if (drag)
57  drag->start(Qt::CopyAction | Qt::MoveAction);
58  }
59 }
void ItemDropProcess(void *, void *)
virtual QStringList mimeTypes() const
virtual bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action)
virtual void mouseMoveEvent(QMouseEvent *event)
virtual Qt::DropActions supportedDropActions() const
void RequestDragObject(QDrag **)
QGo4BrowserTreeWidget(QWidget *parent=0)