1 | // Copyright (C) 2016 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 | |
4 | #ifndef QWIDGETITEMDATA_P_H |
5 | #define QWIDGETITEMDATA_P_H |
6 | |
7 | #include <QtWidgets/private/qtwidgetsglobal_p.h> |
8 | #include <QtCore/qdatastream.h> |
9 | |
10 | // |
11 | // W A R N I N G |
12 | // ------------- |
13 | // |
14 | // This file is not part of the Qt API. It exists purely as an |
15 | // implementation detail. This header file may change from version to |
16 | // version without notice, or even be removed. |
17 | // |
18 | // We mean it. |
19 | // |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | class QWidgetItemData |
24 | { |
25 | public: |
26 | inline QWidgetItemData() : role(-1) {} |
27 | inline QWidgetItemData(int r, const QVariant &v) : role(r), value(v) {} |
28 | int role; |
29 | QVariant value; |
30 | inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; } |
31 | }; |
32 | Q_DECLARE_TYPEINFO(QWidgetItemData, Q_RELOCATABLE_TYPE); |
33 | |
34 | #ifndef QT_NO_DATASTREAM |
35 | |
36 | inline QDataStream &operator>>(QDataStream &in, QWidgetItemData &data) |
37 | { |
38 | in >> data.role; |
39 | in >> data.value; |
40 | return in; |
41 | } |
42 | |
43 | inline QDataStream &operator<<(QDataStream &out, const QWidgetItemData &data) |
44 | { |
45 | out << data.role; |
46 | out << data.value; |
47 | return out; |
48 | } |
49 | |
50 | #endif // QT_NO_DATASTREAM |
51 | |
52 | QT_END_NAMESPACE |
53 | |
54 | #endif // QWIDGETITEMDATA_P_H |
55 |