Debian Codegraph @

examples/script/context2d/qcontext2dcanvas.cpp

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the examples of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** BSD License Usage
18 ** Alternatively, you may use this file under the terms of the BSD license
19 ** as follows:
20 **
21 ** "Redistribution and use in source and binary forms, with or without
22 ** modification, are permitted provided that the following conditions are
23 ** met:
24 ** * Redistributions of source code must retain the above copyright
25 ** notice, this list of conditions and the following disclaimer.
26 ** * Redistributions in binary form must reproduce the above copyright
27 ** notice, this list of conditions and the following disclaimer in
28 ** the documentation and/or other materials provided with the
29 ** distribution.
30 ** * Neither the name of The Qt Company Ltd nor the names of its
31 ** contributors may be used to endorse or promote products derived
32 ** from this software without specific prior written permission.
33 **
34 **
35 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
46 **
47 ** $QT_END_LICENSE$
48 **
49 ****************************************************************************/
50
51 #include "qcontext2dcanvas.h"cxx . . $ `<file>/examples/script/context2d/qcontext2dcanvas.h`/
52
53 #include "context2d.h"cxx . . $ `<file>/examples/script/context2d/context2d.h`/
54 #include "environment.h"cxx . . $ `<file>/examples/script/context2d/environment.h`/
55 #include "domimage.h"cxx . . $ `<file>/examples/script/context2d/domimage.h`/
56
57 #include <QPainter>
58 #include <QPaintEvent>
59
60 //! [3]
61 QContext2DCanvascxx . . $ QContext2DCanvas#::QContext2DCanvascxx . . $ QContext2DCanvas#QContext2DCanvas(182a100ef27846f5).(Context2Dcxx . . $ Context2D# *context, Environmentcxx . . $ Environment# *env, QWidgetcxx . . $ QWidget# *parent)
62 : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), m_contextcxx . . $ QContext2DCanvas#m_context.(context), m_envcxx . . $ QContext2DCanvas#m_env.(env)
63 {
64 QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(context, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(changed(QImage)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(contentsChanged(QImage)));
65 setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true);
66 }
67 //! [3]
68
69 QContext2DCanvascxx . . $ QContext2DCanvas#::~cxx . . $ QContext2DCanvas#`~QContext2DCanvas`(ced63f7c635d850d).QContext2DCanvascxx . . $ QContext2DCanvas#()
70 {
71 }
72
73 Context2Dcxx . . $ Context2D# *QContext2DCanvascxx . . $ QContext2DCanvas#::contextcxx . . $ QContext2DCanvas#context(69fb75f6e5da3473).() const
74 {
75 return m_contextcxx . . $ QContext2DCanvas#m_context.;
76 }
77
78 //! [0]
79 QScriptValuecxx . . $ QScriptValue# QContext2DCanvascxx . . $ QContext2DCanvas#::getContextcxx . . $ QContext2DCanvas#getContext(df477f971a39d688).(const QStringcxx . . $ QString# &str)
80 {
81 if (str !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "2d")
82 return QScriptValuecxx . . $ QScriptValue#QScriptValue(49f6e7a06ebc5aa8).();
83 return m_envcxx . . $ QContext2DCanvas#m_env.->toWrappercxx . . $ Environment#toWrapper(d326e16f4a22f9bc).(m_contextcxx . . $ QContext2DCanvas#m_context.);
84 }
85 //! [0]
86
87 //! [1]
88 void QContext2DCanvascxx . . $ QContext2DCanvas#::contentsChangedcxx . . $ QContext2DCanvas#contentsChanged(9ff1334af0ec69dd).(const QImagecxx . . $ QImage# &image)
89 {
90 m_imagecxx . . $ QContext2DCanvas#m_image. =cxx . . $ QImage#`operator=`(acb38987752f17f1). image;
91 updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
92 }
93
94 void QContext2DCanvascxx . . $ QContext2DCanvas#::paintEventcxx . . $ QContext2DCanvas#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *e)
95 {
96 QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this);
97 p.setClipRectcxx . . $ QPainter#setClipRect(2f5004bd5eb598d2).(e->rectcxx . . $ QPaintEvent#rect(f4023511c62cad66).());
98 p.drawImagecxx . . $ QPainter#drawImage(24e2182690a926fc).(0, 0, m_imagecxx . . $ QContext2DCanvas#m_image.);
99 }
100 //! [1]
101
102 //! [2]
103 void QContext2DCanvascxx . . $ QContext2DCanvas#::mouseMoveEventcxx . . $ QContext2DCanvas#mouseMoveEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *e)
104 {
105 m_envcxx . . $ QContext2DCanvas#m_env.->handleEventcxx . . $ Environment#handleEvent(9d56bc8eee0e55c9).(this, e);
106 }
107
108 void QContext2DCanvascxx . . $ QContext2DCanvas#::mousePressEventcxx . . $ QContext2DCanvas#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *e)
109 {
110 m_envcxx . . $ QContext2DCanvas#m_env.->handleEventcxx . . $ Environment#handleEvent(9d56bc8eee0e55c9).(this, e);
111 }
112
113 void QContext2DCanvascxx . . $ QContext2DCanvas#::mouseReleaseEventcxx . . $ QContext2DCanvas#mouseReleaseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# *e)
114 {
115 m_envcxx . . $ QContext2DCanvas#m_env.->handleEventcxx . . $ Environment#handleEvent(9d56bc8eee0e55c9).(this, e);
116 }
117
118 void QContext2DCanvascxx . . $ QContext2DCanvas#::keyPressEventcxx . . $ QContext2DCanvas#keyPressEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent# *e)
119 {
120 m_envcxx . . $ QContext2DCanvas#m_env.->handleEventcxx . . $ Environment#handleEvent(1ce74e96c8be075e).(this, e);
121 }
122
123 void QContext2DCanvascxx . . $ QContext2DCanvas#::keyReleaseEventcxx . . $ QContext2DCanvas#keyReleaseEvent(c92999c1b6b09cc0).(QKeyEventcxx . . $ QKeyEvent# *e)
124 {
125 m_envcxx . . $ QContext2DCanvas#m_env.->handleEventcxx . . $ Environment#handleEvent(1ce74e96c8be075e).(this, e);
126 }
127 //! [2]
128
129 void QContext2DCanvascxx . . $ QContext2DCanvas#::resizeEventcxx . . $ QContext2DCanvas#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent# *e)
130 {
131 m_contextcxx . . $ QContext2DCanvas#m_context.->setSizecxx . . $ Context2D#setSize(3e454b8ccf442868).(e->sizecxx . . $ QResizeEvent#size(68bda57ac551785b).().widthcxx . . $ QSize#width(ea6fe5115c70a13f).(), e->sizecxx . . $ QResizeEvent#size(68bda57ac551785b).().heightcxx . . $ QSize#height(ea6fe5115c70a13f).());
132 }
133
134 void QContext2DCanvascxx . . $ QContext2DCanvas#::resizecxx . . $ QContext2DCanvas#resize(3e454b8ccf442868).(int width, int height)
135 {
136 QWidgetcxx . . $ QWidget#::resizecxx . . $ QWidget#resize(3e454b8ccf442868).(width, height);
137 }
138
139 void QContext2DCanvascxx . . $ QContext2DCanvas#::resetcxx . . $ QContext2DCanvas#reset(49f6e7a06ebc5aa8).()
140 {
141 m_contextcxx . . $ QContext2DCanvas#m_context.->resetcxx . . $ Context2D#reset(49f6e7a06ebc5aa8).();
142 }
143
144 void QContext2DCanvascxx . . $ QContext2DCanvas#::addEventListenercxx . . $ QContext2DCanvas#addEventListener(32d10e5558e2d27f).(const QStringcxx . . $ QString# &type, const QScriptValuecxx . . $ QScriptValue# &listener,
145 bool useCapture)
146 {
147 Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(useCapture);
148 if (listener.isFunctioncxx . . $ QScriptValue#isFunction(50ce9a9e25b4a850).()) {
149 QScriptValuecxx . . $ QScriptValue# self = m_envcxx . . $ QContext2DCanvas#m_env.->toWrappercxx . . $ Environment#toWrapper(d326e16f4a22f9bc).(this);
150 self.setPropertycxx . . $ QScriptValue#setProperty(e166b3a4cfa646).("on" +cxx . . $ operator+(c75c3ae4eb9af1a8). type, listener);
151 }
152 }