Computer Assited Medical Intervention Tool Kit  version 5.0
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  Q_OBJECT
54 public:
55  CanvasView(QWidget* parent = 0)
56  : QtCanvasView(parent), moving(0) { }
57  CanvasView(QtCanvas* canvas, QWidget* parent = 0)
58  : QtCanvasView(canvas, parent), moving(0) { }
59 signals:
60  void itemClicked(QtCanvasItem* item);
61  void itemMoved(QtCanvasItem* item);
62 protected:
63  void contentsMousePressEvent(QMouseEvent* event);
64  void contentsMouseDoubleClickEvent(QMouseEvent* event);
65  void contentsMouseMoveEvent(QMouseEvent* event);
66 private:
67  void handleMouseClickEvent(QMouseEvent* event);
68  QPoint moving_start;
70 };
71 
72 class MainWindow : public QMainWindow {
73  Q_OBJECT
74 public:
75  MainWindow(QWidget* parent = 0);
76 
77 private slots:
78  void newRectangle();
79  void newEllipse();
80  void newLine();
81  void newText();
82  void deleteObject();
83  void clearAll();
84  void fillView();
85 
86 
87  void itemClicked(QtCanvasItem* item);
88  void itemMoved(QtCanvasItem* item);
89  void valueChanged(QtProperty* property, const QVariant& value);
90 private:
91 
96  void addProperty(QtVariantProperty* property, const QString& id);
97  void updateExpandState();
98 
99  QAction* deleteAction;
100 
102 
105  QtCanvas* canvas;
107  QMap<QtProperty*, QString> propertyToId;
108  QMap<QString, QtVariantProperty*> idToProperty;
109  QMap<QString, bool> idToExpanded;
110 };
111 
112 #endif
MainWindow::variantManager
class QtVariantPropertyManager * variantManager
Definition: canvas_variant/mainwindow.h:101
QtTreePropertyBrowser
The description of this class will come soon !
Definition: qttreepropertybrowser.h:60
MainWindow::addProperty
void addProperty(QtProperty *property, const QString &id)
Definition: canvas_typed/mainwindow.cpp:372
MainWindow::addRectangle
QtCanvasItem * addRectangle()
Definition: canvas_typed/mainwindow.cpp:220
MainWindow::clearAll
void clearAll()
Definition: canvas_typed/mainwindow.cpp:203
MainWindow::propertyToId
QMap< QtProperty *, QString > propertyToId
Definition: canvas_typed/mainwindow.h:113
MainWindow::updateExpandState
void updateExpandState()
Definition: canvas_typed/mainwindow.cpp:271
MainWindow::canvas
QtCanvas * canvas
Definition: canvas_typed/mainwindow.h:111
MainWindow::addLine
QtCanvasItem * addLine()
Definition: canvas_typed/mainwindow.cpp:240
MainWindow::idToProperty
QMap< QString, QtVariantProperty * > idToProperty
Definition: canvas_variant/mainwindow.h:108
QtVariantPropertyManager
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition: qtvariantproperty.h:119
QtCanvasView::canvas
QtCanvas * canvas() const
Definition: canvas_typed/qtcanvas.h:374
QtProperty
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:113
CanvasView::contentsMousePressEvent
void contentsMousePressEvent(QMouseEvent *event)
Definition: canvas_typed/mainwindow.cpp:51
CanvasView::itemMoved
void itemMoved(QtCanvasItem *item)
MainWindow::valueChanged
void valueChanged(QtProperty *property, double value)
Definition: canvas_typed/mainwindow.cpp:381
MainWindow::newText
void newText()
Definition: canvas_typed/mainwindow.cpp:187
MainWindow::itemMoved
void itemMoved(QtCanvasItem *item)
Definition: canvas_typed/mainwindow.cpp:261
MainWindow::itemClicked
void itemClicked(QtCanvasItem *item)
Definition: canvas_typed/mainwindow.cpp:281
QtVariantProperty
The QtVariantProperty class is a convenience class handling QVariant based properties.
Definition: qtvariantproperty.h:97
CanvasView::handleMouseClickEvent
void handleMouseClickEvent(QMouseEvent *event)
Definition: canvas_typed/mainwindow.cpp:59
MainWindow::newEllipse
void newEllipse()
Definition: canvas_typed/mainwindow.cpp:175
MainWindow
Definition: canvas_typed/mainwindow.h:69
MainWindow::deleteAction
QAction * deleteAction
Definition: canvas_typed/mainwindow.h:100
QtCanvasItem
Definition: canvas_typed/qtcanvas.h:67
CanvasView::contentsMouseDoubleClickEvent
void contentsMouseDoubleClickEvent(QMouseEvent *event)
Definition: canvas_typed/mainwindow.cpp:55
CanvasView::moving
QtCanvasItem * moving
Definition: canvas_typed/mainwindow.h:66
MainWindow::fillView
void fillView()
Definition: canvas_typed/mainwindow.cpp:210
CanvasView::CanvasView
CanvasView(QWidget *parent=0)
Definition: canvas_variant/mainwindow.h:55
MainWindow::canvasView
CanvasView * canvasView
Definition: canvas_typed/mainwindow.h:110
CanvasView::itemClicked
void itemClicked(QtCanvasItem *item)
CanvasView
Definition: canvas_typed/mainwindow.h:49
MainWindow::addEllipse
QtCanvasItem * addEllipse()
Definition: canvas_typed/mainwindow.cpp:231
qtcanvas.h
MainWindow::idToExpanded
QMap< QString, bool > idToExpanded
Definition: canvas_typed/mainwindow.h:115
MainWindow::MainWindow
MainWindow(QWidget *parent=0)
Definition: canvas_typed/mainwindow.cpp:81
MainWindow::currentItem
QtCanvasItem * currentItem
Definition: canvas_typed/mainwindow.h:112
QtCanvas
Definition: canvas_typed/qtcanvas.h:213
MainWindow::deleteObject
void deleteObject()
Definition: canvas_typed/mainwindow.cpp:193
CanvasView::CanvasView
CanvasView(QtCanvas *canvas, QWidget *parent=0)
Definition: canvas_variant/mainwindow.h:57
MainWindow::propertyEditor
class QtTreePropertyBrowser * propertyEditor
Definition: canvas_typed/mainwindow.h:109
CanvasView::contentsMouseMoveEvent
void contentsMouseMoveEvent(QMouseEvent *event)
Definition: canvas_typed/mainwindow.cpp:70
QtCanvasView
Definition: canvas_typed/qtcanvas.h:365
MainWindow::addText
QtCanvasItem * addText()
Definition: canvas_typed/mainwindow.cpp:251
MainWindow::newLine
void newLine()
Definition: canvas_typed/mainwindow.cpp:181
MainWindow::newRectangle
void newRectangle()
Definition: canvas_typed/mainwindow.cpp:169
CanvasView::moving_start
QPoint moving_start
Definition: canvas_typed/mainwindow.h:65