Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
canvas_variant/mainwindow.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 **
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 **
8 ** This file is part of a Qt Solutions component.
9 **
10 ** You may use this file under the terms of the BSD license as follows:
11 **
12 ** "Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
14 ** met:
15 ** * Redistributions of source code must retain the above copyright
16 ** notice, this list of conditions and the following disclaimer.
17 ** * Redistributions in binary form must reproduce the above copyright
18 ** notice, this list of conditions and the following disclaimer in
19 ** the documentation and/or other materials provided with the
20 ** distribution.
21 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
22 ** the names of its contributors may be used to endorse or promote
23 ** products derived from this software without specific prior written
24 ** permission.
25 **
26 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 **
38 ****************************************************************************/
39 
40 #ifndef MAINWINDOW_H
41 #define MAINWINDOW_H
42 
43 #include <QtGui/QMainWindow>
44 #include <QtCore/QMap>
45 #include "qtcanvas.h"
46 
47 class QtVariantProperty;
48 class QtProperty;
49 
50 class QtBrowserIndex;
51 
52 class CanvasView : public QtCanvasView
53 {
54  Q_OBJECT
55 public:
56  CanvasView(QWidget *parent = 0)
57  : QtCanvasView(parent), moving(0) { }
58  CanvasView(QtCanvas *canvas, QWidget *parent = 0)
59  : QtCanvasView(canvas, parent), moving(0) { }
60 signals:
61  void itemClicked(QtCanvasItem *item);
62  void itemMoved(QtCanvasItem *item);
63 protected:
64  void contentsMousePressEvent(QMouseEvent *event);
65  void contentsMouseDoubleClickEvent(QMouseEvent *event);
66  void contentsMouseMoveEvent(QMouseEvent* event);
67 private:
68  void handleMouseClickEvent(QMouseEvent *event);
69  QPoint moving_start;
71 };
72 
73 class MainWindow : public QMainWindow
74 {
75  Q_OBJECT
76 public:
77  MainWindow(QWidget *parent = 0);
78 
79 private slots:
80  void newRectangle();
81  void newEllipse();
82  void newLine();
83  void newText();
84  void deleteObject();
85  void clearAll();
86  void fillView();
87 
88 
89  void itemClicked(QtCanvasItem *item);
90  void itemMoved(QtCanvasItem *item);
91  void valueChanged(QtProperty *property, const QVariant &value);
92 private:
93 
98  void addProperty(QtVariantProperty *property, const QString &id);
99  void updateExpandState();
100 
101  QAction *deleteAction;
102 
104 
107  QtCanvas *canvas;
109  QMap<QtProperty *, QString> propertyToId;
110  QMap<QString, QtVariantProperty *> idToProperty;
111  QMap<QString, bool> idToExpanded;
112 };
113 
114 #endif
void itemMoved(QtCanvasItem *item)
void fillView()
QtCanvas * canvas
Definition: canvas_typed/mainwindow.h:113
void updateExpandState()
void itemClicked(QtCanvasItem *item)
void itemClicked(QtCanvasItem *item)
QtCanvasItem * currentItem
Definition: canvas_typed/mainwindow.h:114
void newRectangle()
class QtTreePropertyBrowser * propertyEditor
Definition: canvas_typed/mainwindow.h:111
Definition: canvas_typed/qtcanvas.h:189
Definition: canvas_typed/mainwindow.h:49
Definition: qtvariantproperty.h:84
CanvasView(QtCanvas *canvas, QWidget *parent=0)
Definition: canvas_variant/mainwindow.h:58
QMap< QString, bool > idToExpanded
Definition: canvas_typed/mainwindow.h:117
QtCanvasItem * moving
Definition: canvas_typed/mainwindow.h:67
CanvasView(QWidget *parent=0)
Definition: canvas_variant/mainwindow.h:56
The description of this class will come soon !
Definition: qttreepropertybrowser.h:60
void addProperty(QtProperty *property, const QString &id)
void newEllipse()
QPoint moving_start
Definition: canvas_typed/mainwindow.h:66
QtCanvas * canvas() const
Definition: canvas_typed/qtcanvas.h:337
QtCanvasItem * addLine()
void contentsMouseMoveEvent(QMouseEvent *event)
class QtVariantPropertyManager * variantManager
Definition: canvas_variant/mainwindow.h:103
MainWindow(QWidget *parent=0)
void valueChanged(QtProperty *property, double value)
void newLine()
void clearAll()
QMap< QtProperty *, QString > propertyToId
Definition: canvas_typed/mainwindow.h:115
QtCanvasItem * addText()
QAction * deleteAction
Definition: canvas_typed/mainwindow.h:102
void contentsMousePressEvent(QMouseEvent *event)
Definition: canvas_typed/qtcanvas.h:327
QtCanvasItem * addRectangle()
The description of this class will come soon !
Definition: qtvariantproperty.h:64
Definition: canvas_typed/qtcanvas.h:67
CanvasView * canvasView
Definition: canvas_typed/mainwindow.h:112
void handleMouseClickEvent(QMouseEvent *event)
The description of this class will come soon !
Definition: qtpropertybrowser.h:74
QMap< QString, QtVariantProperty * > idToProperty
Definition: canvas_variant/mainwindow.h:110
QtCanvasItem * addEllipse()
void newText()
void contentsMouseDoubleClickEvent(QMouseEvent *event)
Definition: canvas_typed/mainwindow.h:70
void deleteObject()
void itemMoved(QtCanvasItem *item)