Coverage Report

Created: 2026-08-11 07:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtbase/src/gui/kernel/qinputdevice_p.h
Line
Count
Source
1
// Copyright (C) 2020 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
5
#ifndef QINPUTDEVICE_P_H
6
#define QINPUTDEVICE_P_H
7
8
//
9
//  W A R N I N G
10
//  -------------
11
//
12
// This file is not part of the Qt API.  It exists purely as an
13
// implementation detail.  This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#include <QtGui/private/qtguiglobal_p.h>
20
#include <QtGui/qinputdevice.h>
21
#include "private/qobject_p.h"
22
23
QT_BEGIN_NAMESPACE
24
25
class Q_GUI_EXPORT QInputDevicePrivate : public QObjectPrivate
26
{
27
0
    Q_DECLARE_PUBLIC(QInputDevice)
Unexecuted instantiation: QInputDevicePrivate::q_func()
Unexecuted instantiation: QInputDevicePrivate::q_func() const
28
0
public:
29
0
    QInputDevicePrivate(const QString &name, qint64 winSysId, QInputDevice::DeviceType type,
30
0
                        QInputDevice::Capabilities caps = QInputDevice::Capability::None,
31
0
                        const QString &seatName = QString())
32
0
      : name(name), seatName(seatName), systemId(winSysId), capabilities(caps),
33
0
        deviceType(type)
34
0
    {
35
        // if the platform doesn't provide device IDs, make one up,
36
        // but try to avoid clashing with OS-provided 32-bit IDs
37
0
        static qint64 nextId = qint64(1) << 33;
38
0
        if (!systemId)
39
0
            systemId = nextId++;
40
0
    }
41
    ~QInputDevicePrivate() override;
42
43
    QString name;
44
    QString seatName;
45
    QString busId;
46
    QRect availableVirtualGeometry;
47
    void *qqExtra = nullptr;    // Qt Quick can store arbitrary device-specific data here
48
    qint64 systemId = 0;
49
    QInputDevice::Capabilities capabilities = QInputDevice::Capability::None;
50
    QInputDevice::DeviceType deviceType = QInputDevice::DeviceType::Unknown;
51
    bool pointingDeviceType = false;
52
53
    static void registerDevice(const QInputDevice *dev);
54
    static void unregisterDevice(const QInputDevice *dev);
55
    static bool isRegistered(const QInputDevice *dev);
56
    static const QInputDevice *fromId(qint64 systemId);
57
58
    void setAvailableVirtualGeometry(QRect a)
59
0
    {
60
0
        if (a == availableVirtualGeometry)
61
0
            return;
62
0
63
0
        availableVirtualGeometry = a;
64
0
        setCapabilities(capabilities | QInputDevice::Capability::NormalizedPosition);
65
0
        Q_Q(QInputDevice);
66
0
        Q_EMIT q->availableVirtualGeometryChanged(availableVirtualGeometry);
67
0
    }
68
69
    void setCapabilities(QInputDevice::Capabilities c)
70
0
    {
71
0
        if (c == capabilities)
72
0
            return;
73
74
0
        capabilities = c;
75
0
        Q_Q(QInputDevice);
76
0
        Q_EMIT q->capabilitiesChanged(capabilities);
77
0
    }
78
79
    inline static QInputDevicePrivate *get(QInputDevice *q)
80
0
    {
81
0
        return static_cast<QInputDevicePrivate *>(QObjectPrivate::get(q));
82
0
    }
83
84
    inline static const QInputDevicePrivate *get(const QInputDevice *q)
85
0
    {
86
0
        return static_cast<const QInputDevicePrivate *>(QObjectPrivate::get(q));
87
0
    }
88
};
89
90
QT_END_NAMESPACE
91
92
#endif // QINPUTDEVICE_P_H