mainwindow.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
5
**
6
** This file is part of the Qt Solutions component.
7
**
8
** $QT_BEGIN_LICENSE:BSD$
9
** You may use this file under the terms of the BSD license as follows:
10
**
11
** "Redistribution and use in source and binary forms, with or without
12
** modification, are permitted provided that the following conditions are
13
** met:
14
** * Redistributions of source code must retain the above copyright
15
** notice, this list of conditions and the following disclaimer.
16
** * Redistributions in binary form must reproduce the above copyright
17
** notice, this list of conditions and the following disclaimer in
18
** the documentation and/or other materials provided with the
19
** distribution.
20
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21
** of its contributors may be used to endorse or promote products derived
22
** from this software without specific prior written permission.
23
**
24
**
25
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36
**
37
** $QT_END_LICENSE$
38
**
39
****************************************************************************/
40
41
#pragma once
42
43
#include <QMainWindow>
44
#include <QMap>
45
46
#include "
qtcanvas.h
"
47
48
class
QtVariantProperty
;
49
class
QtProperty
;
50
51
class
QtBrowserIndex;
52
53
class
CanvasView
:
public
QtCanvasView
54
{
55
Q_OBJECT
56
public
:
57
CanvasView
(QWidget* parent = 0) :
QtCanvasView
(parent), moving(0)
58
{
59
}
60
61
CanvasView
(
QtCanvas
*
canvas
, QWidget* parent = 0) :
QtCanvasView
(
canvas
, parent), moving(0)
62
{
63
}
64
65
signals:
66
void
itemClicked
(
QtCanvasItem
* item);
67
void
itemMoved
(
QtCanvasItem
* item);
68
69
protected
:
70
void
contentsMousePressEvent
(QMouseEvent* event);
71
void
contentsMouseDoubleClickEvent
(QMouseEvent* event);
72
void
contentsMouseMoveEvent
(QMouseEvent* event);
73
74
private
:
75
void
handleMouseClickEvent(QMouseEvent* event);
76
QPoint moving_start;
77
QtCanvasItem
* moving;
78
};
79
80
class
MainWindow
:
public
QMainWindow
81
{
82
Q_OBJECT
83
public
:
84
MainWindow
(QWidget* parent = 0);
85
86
private
slots:
87
void
newRectangle();
88
void
newEllipse();
89
void
newLine();
90
void
newText();
91
void
deleteObject();
92
void
clearAll();
93
void
fillView();
94
95
96
void
itemClicked(
QtCanvasItem
* item);
97
void
itemMoved(
QtCanvasItem
* item);
98
void
valueChanged(
QtProperty
* property,
const
QVariant&
value
);
99
100
private
:
101
QtCanvasItem
* addRectangle();
102
QtCanvasItem
* addEllipse();
103
QtCanvasItem
* addLine();
104
QtCanvasItem
* addText();
105
void
addProperty(
QtVariantProperty
* property,
const
QString&
id
);
106
void
updateExpandState();
107
108
QAction* deleteAction;
109
110
class
QtVariantPropertyManager
* variantManager;
111
112
class
QtTreePropertyBrowser
* propertyEditor;
113
CanvasView
* canvasView;
114
QtCanvas
* canvas;
115
QtCanvasItem
*
currentItem
;
116
QMap<QtProperty*, QString> propertyToId;
117
QMap<QString, QtVariantProperty*> idToProperty;
118
QMap<QString, bool> idToExpanded;
119
};
CanvasView::contentsMouseDoubleClickEvent
void contentsMouseDoubleClickEvent(QMouseEvent *event)
Definition:
mainwindow.cpp:61
QtTreePropertyBrowser
The QtTreePropertyBrowser class provides QTreeWidget based property browser.
Definition:
qttreepropertybrowser.h:51
CanvasView::itemClicked
void itemClicked(QtCanvasItem *item)
CanvasView::itemMoved
void itemMoved(QtCanvasItem *item)
MainWindow::MainWindow
MainWindow(QWidget *parent=0)
Definition:
mainwindow.cpp:95
QtVariantPropertyManager
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition:
qtvariantproperty.h:78
QtProperty
The QtProperty class encapsulates an instance of a property.
Definition:
qtpropertybrowser.h:71
QtVariantProperty
The QtVariantProperty class is a convenience class handling QVariant based properties.
Definition:
qtvariantproperty.h:56
CanvasView::CanvasView
CanvasView(QWidget *parent=0)
Definition:
mainwindow.h:57
cxxopts::value
std::shared_ptr< Value > value()
Definition:
cxxopts.hpp:855
MainWindow
Definition:
mainwindow.h:77
QtCanvasItem
Definition:
qtcanvas.h:67
CanvasView::contentsMousePressEvent
void contentsMousePressEvent(QMouseEvent *event)
Definition:
mainwindow.cpp:55
CanvasView
Definition:
mainwindow.h:50
qtcanvas.h
CanvasView::contentsMouseMoveEvent
void contentsMouseMoveEvent(QMouseEvent *event)
Definition:
mainwindow.cpp:83
QtCanvas
Definition:
qtcanvas.h:270
CanvasView::CanvasView
CanvasView(QtCanvas *canvas, QWidget *parent=0)
Definition:
mainwindow.h:61
QtAbstractPropertyBrowser::currentItem
QtBrowserItem * currentItem() const
Definition:
qtpropertybrowser.cpp:2270
QtCanvasView
Definition:
qtcanvas.h:464
QtCanvasView::canvas
QtCanvas * canvas() const
Definition:
qtcanvas.h:474
ArmarXGui
libraries
qtpropertybrowser
examples
canvas_variant
mainwindow.h
Generated by
1.8.17