Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qabstractcollisionshape.cpp
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qabstractcollisionshape_p.h"
6
7
#
include
<
QtQml
/
QQmlListReference
>
8
9
#
include
"qphysicsworld_p.h"
10
11
QT_BEGIN_NAMESPACE
12
13
/*!
14
\qmltype CollisionShape
15
\inherits Node
16
\inqmlmodule QtQuick3D.Physics
17
\since 6.4
18
\brief Base type for collision shapes.
19
20
This is the base type for all collision shapes. A collision shape
21
is used to define the physical shape and extent of an object for the
22
purposes of the physics simulation.
23
24
\sa {Qt Quick 3D Physics Shapes, Bodies and Joints}
25
*/
26
27
/*!
28
\qmlproperty bool CollisionShape::enableDebugDraw
29
This property enables drawing the shape's debug view.
30
31
Default value: \c{false}
32
*/
33
34
QAbstractCollisionShape::QAbstractCollisionShape(QQuick3DNode *parent) : QQuick3DNode(parent)
35
{
36
connect(
this
, &QQuick3DNode::sceneScaleChanged,
this
,
37
&QAbstractCollisionShape::handleScaleChange);
38
}
39
40
QAbstractCollisionShape::~QAbstractCollisionShape() =
default
;
41
42
bool
QAbstractCollisionShape::enableDebugDraw()
const
43
{
44
return
m_enableDebugDraw;
45
}
46
47
void
QAbstractCollisionShape::setEnableDebugDraw(
bool
enableDebugDraw)
48
{
49
if
(m_enableDebugDraw == enableDebugDraw)
50
return
;
51
52
if
(
auto
world = QPhysicsWorld::getWorld(
this
); world !=
nullptr
&& enableDebugDraw)
53
world->setHasIndividualDebugDraw();
54
55
m_enableDebugDraw = enableDebugDraw;
56
emit enableDebugDrawChanged(m_enableDebugDraw);
57
}
58
59
void
QAbstractCollisionShape::handleScaleChange()
60
{
61
auto
newScale = sceneScale();
62
if
(!qFuzzyCompare(newScale, m_prevScale)) {
63
m_prevScale = newScale;
64
m_scaleDirty =
true
;
65
emit needsRebuild(
this
);
// TODO: remove signal argument?
66
}
67
}
68
69
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtquick3dphysics
src
quick3dphysics
qabstractcollisionshape.cpp
Generated on
for Qt by
1.18.0