OpenWalnut
1.5.0dev
src
qtgui
networkEditor
WQtNetworkScene.cpp
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#include <iostream>
26
#include <memory>
27
#include <string>
28
29
#include <QDockWidget>
30
#include <QGraphicsItemGroup>
31
#include <QGraphicsSceneMouseEvent>
32
#include <QGraphicsView>
33
#include <QVBoxLayout>
34
35
#include "../WMainWindow.h"
36
#include "WQtNetworkItem.h"
37
#include "WQtNetworkPort.h"
38
#include "WQtNetworkScene.h"
39
40
WQtNetworkScene::WQtNetworkScene
(
QObject
* parent )
41
:
QGraphicsScene
( parent )
42
{
43
setItemIndexMethod( NoIndex );
44
// this takes care of the segfault: QGraphicsSceneFindItemBspTreeVisitor::visit
45
// seems to be a Qt bug, testet with qt4 4.7.0
46
}
47
48
WQtNetworkScene::~WQtNetworkScene
()
49
{
50
}
51
52
void
WQtNetworkScene::dragEnterEvent
( QGraphicsSceneDragDropEvent* event )
53
{
54
// only ask the main window
55
if
(
WMainWindow::isDropAcceptable
( event->mimeData() ) )
56
{
57
event
->acceptProposedAction();
58
}
59
}
60
61
void
WQtNetworkScene::dragMoveEvent
( QGraphicsSceneDragDropEvent* event )
62
{
63
if
(
WMainWindow::isDropAcceptable
( event->mimeData() ) )
64
{
65
event
->acceptProposedAction();
66
}
67
}
68
QGraphicsScene
QObject
WMainWindow::isDropAcceptable
static bool isDropAcceptable(const QMimeData *mimeData)
This method checks whether a given drop event is acceptable.
Definition:
WMainWindow.cpp:1300
WQtNetworkScene::dragEnterEvent
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
Event handler when pulling something inside the scene.
Definition:
WQtNetworkScene.cpp:52
WQtNetworkScene::~WQtNetworkScene
virtual ~WQtNetworkScene()
Destructor.
Definition:
WQtNetworkScene.cpp:48
WQtNetworkScene::dragMoveEvent
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
Event handler when pulling something in the scene.
Definition:
WQtNetworkScene.cpp:61
WQtNetworkScene::WQtNetworkScene
WQtNetworkScene(QObject *parent=NULL)
Constructor.
Definition:
WQtNetworkScene.cpp:40
Generated by
1.9.1