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
qquickdragaxis.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
#
include
"qquickdragaxis_p.h"
5
#
include
"qquickpointerhandler_p.h"
6
#
include
<
QtQuick
/
qquickitem
.
h
>
7
#
include
<
limits
>
8
9
QT_BEGIN_NAMESPACE
10
11
Q_STATIC_LOGGING_CATEGORY
(lcDragAxis,
"qt.quick.pointer.dragaxis"
)
12
13
QQuickDragAxis::QQuickDragAxis(QQuickPointerHandler *handler,
const
QString &propertyName, qreal initValue)
14
: QObject(handler), m_accumulatedValue(initValue), m_propertyName(propertyName)
15
{
16
}
17
18
void
QQuickDragAxis::setMinimum(qreal minimum)
19
{
20
if
(m_minimum == minimum)
21
return
;
22
23
m_minimum = minimum;
24
emit minimumChanged();
25
}
26
27
void
QQuickDragAxis::setMaximum(qreal maximum)
28
{
29
if
(m_maximum == maximum)
30
return
;
31
32
m_maximum = maximum;
33
emit maximumChanged();
34
}
35
36
void
QQuickDragAxis::setEnabled(
bool
enabled)
37
{
38
if
(m_enabled == enabled)
39
return
;
40
41
m_enabled = enabled;
42
emit enabledChanged();
43
}
44
45
void
QQuickDragAxis::onActiveChanged(
bool
active, qreal initActiveValue)
46
{
47
m_activeValue = initActiveValue;
48
m_startValue = m_accumulatedValue;
49
qCDebug(lcDragAxis) << parent() << m_propertyName << active <<
": init active"
<< m_activeValue
50
<<
"target start"
<< m_startValue;
51
}
52
53
void
QQuickDragAxis::updateValue(qreal activeValue, qreal accumulatedValue, qreal delta)
54
{
55
if
(!m_enabled)
56
return
;
57
58
m_activeValue = activeValue;
59
m_accumulatedValue = qBound(m_minimum, accumulatedValue, m_maximum);
60
qCDebug(lcDragAxis) << parent() << m_propertyName <<
"values: active"
<< activeValue
61
<<
"accumulated"
<< m_accumulatedValue <<
"delta"
<< delta;
62
emit activeValueChanged(delta);
63
}
64
65
QT_END_NAMESPACE
66
67
#
include
"moc_qquickdragaxis_p.cpp"
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
qtdeclarative
src
quick
handlers
qquickdragaxis.cpp
Generated on
for Qt by
1.18.0