tuchulcha  0.10.1
Graphical Workflow Configuration Editor
CentralMdiArea.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2012 David Stronczek
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17 */
24 #include "CentralMdiArea.h"
25 
26 #include <QMdiArea>
27 #include <QtGui>
28 
29 CentralMdiArea::CentralMdiArea(QWidget* pp) : QMdiArea(pp) {
30  setAcceptDrops(true);
31  viewport()->setAcceptDrops(true);
32 }
33 
34 void CentralMdiArea::dragEnterEvent(QDragEnterEvent* e) {
35  e->acceptProposedAction();
36 }
37 
38 void CentralMdiArea::dragMoveEvent(QDragMoveEvent* e) {
39  e->acceptProposedAction();
40 }
41 
42 void CentralMdiArea::dropEvent(QDropEvent* e) {
43  const QMimeData *mimeData = e->mimeData();
44 
45  QStringList files;
46 
47  if (mimeData->hasUrls()) {
48  QList<QUrl> urlList = mimeData->urls();
49  for (int i = 0; i < urlList.size(); i++) {
50  QString url = urlList.at(i).path();
51  files << url;
52  }
53  }
54  e->acceptProposedAction();
55 
56  if (!files.isEmpty()) {
57  emit filesDropped(files);
58  }
59 }
Declaration of class CentralMdiArea.
virtual void dragEnterEvent(QDragEnterEvent *event)
drag enter event
void filesDropped(const QStringList list)
files dropped inside area
virtual void dragMoveEvent(QDragMoveEvent *event)
drage move event
virtual void dropEvent(QDropEvent *event)
drop event
CentralMdiArea(QWidget *parent=0)
Default constructor, setting parent widget.