blob: 7429735ef9497f1cb44e4649eccfc23e10e367b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "filterkey_p.h"
#include <Qt3DRender/private/qfilterkey_p.h>
QT_BEGIN_NAMESPACE
using namespace Qt3DCore;
namespace Qt3DRender {
namespace Render {
FilterKey::FilterKey()
: BackendNode()
{
}
FilterKey::~FilterKey()
{
cleanup();
}
void FilterKey::cleanup()
{
QBackendNode::setEnabled(false);
m_name.clear();
m_value.clear();
}
void FilterKey::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
{
const QFilterKey *node = qobject_cast<const QFilterKey *>(frontEnd);
if (!node)
return;
BackendNode::syncFromFrontEnd(frontEnd, firstTime);
if (node->name() != m_name) {
m_name = node->name();
markDirty(AbstractRenderer::AllDirty);
}
if (node->value() != m_value) {
m_value = node->value();
markDirty(AbstractRenderer::AllDirty);
}
}
bool FilterKey::equals(const FilterKey &other) const
{
if (&other == this)
return true;
// TODO create a QVaraint::fastCompare function that returns false
// if types are not equal. For now, applying
// https://codereview.qt-project.org/#/c/204484/
// and adding the following early comparison of the types should give
// an equivalent performance gain:
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return (other.value().metaType() == value().metaType() &&
#else
return (other.value().type() == value().type() &&
#endif
other.name() == name() &&
other.value() == value());
}
} // namespace Render
} // namespace Qt3DRender
QT_END_NAMESPACE
|