Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dutils_p.h
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
#
ifndef
QQUICK3DUTILS_P_H
5
#
define
QQUICK3DUTILS_P_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
type_traits
>
19
20
#
include
<
QtCore
/
QtGlobal
>
21
#
include
<
private
/
qglobal_p
.
h
>
22
23
QT_BEGIN_NAMESPACE
24
25
template
<
typename
T,
typename
=
void
>
26
struct
hasFuzzyCompare : std::false_type {};
27
28
template
<
typename
T>
29
struct
hasFuzzyCompare
<
T
,
std
::
void_t
<
decltype
(
qFuzzyCompare
(
std
::
declval
<
T
&>(),
std
::
declval
<
T
&>()))>> :
std
::
true_type
{};
30
31
// Assigns 'updated' to 'orig' and returns true if they are different
32
template
<
typename
T, std::enable_if_t<!hasFuzzyCompare<T>::value,
bool
> =
true
>
33
bool
qUpdateIfNeeded
(T &orig, T updated)
34
{
35
if
(orig == updated)
36
return
false
;
37
orig = updated;
38
return
true
;
39
}
40
41
// Assigns 'updated' to 'orig' and returns true if they are different, compared with qFuzzyCompare
42
template
<
typename
T, std::enable_if_t<hasFuzzyCompare<T>::value,
bool
> =
true
>
43
bool
qUpdateIfNeeded
(T &orig, T updated)
44
{
45
if
(qFuzzyCompare(orig, updated))
46
return
false
;
47
orig = updated;
48
return
true
;
49
}
50
51
QT_END_NAMESPACE
52
53
#
endif
// QQUICK3DUTILS_P_H
QQuick3DCamera
Definition
qquick3dcamera_p.h:24
QQuick3DQuaternionUtils
Definition
qquick3dquaternionutils_p.h:28
QPlatformGraphicsBufferHelper
\inmodule QtGui
qUpdateIfNeeded
bool qUpdateIfNeeded(T &orig, T updated)
Definition
qquick3dutils_p.h:33
hasFuzzyCompare< T, std::void_t< decltype(qFuzzyCompare(std::declval< T & >(), std::declval< T & >()))> >
Definition
qquick3dutils_p.h:29
qtquick3d
src
quick3d
qquick3dutils_p.h
Generated on
for Qt by
1.14.0