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