SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModuleProxyWidget.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef INTERFACE_APPLICATION_MODULEPROXYWIDGET_H
30 #define INTERFACE_APPLICATION_MODULEPROXYWIDGET_H
31 
34 #include <QGraphicsProxyWidget>
35 
36 namespace SCIRun
37 {
38  namespace Gui
39  {
40  class ModuleWidget;
41 
42  class ModuleProxyWidget : public QGraphicsProxyWidget, public NoteDisplayHelper
43  {
44  Q_OBJECT
45 
46  public:
47  explicit ModuleProxyWidget(ModuleWidget* module, QGraphicsItem* parent = 0);
50 
51  public Q_SLOTS:
52  void highlightIfSelected();
53  void setAsWaiting();
54  void setDefaultNotePosition(NotePosition position);
56 
57  Q_SIGNALS:
58  void selected();
59  void widgetMoved(const SCIRun::Dataflow::Networks::ModuleId& id, double newX, double newY);
60  protected:
61  void mousePressEvent(QGraphicsSceneMouseEvent *event);
62  void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
63  void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
64  QVariant itemChange(GraphicsItemChange change, const QVariant& value);
65  virtual void setNoteGraphicsContext() override;
66  private Q_SLOTS:
67  void updateNote(const Note& note);
68  private:
69  bool isSubwidget(QWidget* alienWidget) const;
70  void updatePressedSubWidget(QGraphicsSceneMouseEvent* event);
71  void addPort();
72 
73  ModuleWidget* module_;
74  bool grabbedByWidget_, isSelected_;
75  QWidget* pressedSubWidget_;
76  QPointF position_;
77  };
78 
79  }
80 }
81 
82 #endif
void highlightIfSelected()
Definition: ModuleProxyWidget.cc:209
ModuleWidget * getModuleWidget()
Definition: ModuleProxyWidget.cc:135
Definition: Note.h:58
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: ModuleProxyWidget.cc:188
virtual void setNoteGraphicsContext() override
Definition: ModuleProxyWidget.cc:263
NotePosition
Definition: Note.h:47
ModuleProxyWidget(ModuleWidget *module, QGraphicsItem *parent=0)
Definition: ModuleProxyWidget.cc:111
Definition: ModuleProxyWidget.h:42
void setAsWaiting()
Definition: ModuleProxyWidget.cc:223
Definition: ModuleDescription.h:77
~ModuleProxyWidget()
Definition: ModuleProxyWidget.cc:126
void createPortPositionProviders()
Definition: ModuleProxyWidget.cc:237
Definition: ModuleWidget.h:58
QVariant itemChange(GraphicsItemChange change, const QVariant &value)
Definition: ModuleProxyWidget.cc:228
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: ModuleProxyWidget.cc:140
Definition: Note.h:92
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: ModuleProxyWidget.cc:166
void setDefaultNotePosition(NotePosition position)
Definition: ModuleProxyWidget.cc:270
void widgetMoved(const SCIRun::Dataflow::Networks::ModuleId &id, double newX, double newY)