Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwidgetitemdata_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QWIDGETITEMDATA_P_H
6#define QWIDGETITEMDATA_P_H
7
8#include <QtWidgets/private/qtwidgetsglobal_p.h>
9#include <QtCore/qdatastream.h>
10#include <QtCore/qvariant.h>
11
12//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. It exists purely as an
17// implementation detail. This header file may change from version to
18// version without notice, or even be removed.
19//
20// We mean it.
21//
22
24
26{
27public:
28 inline QWidgetItemData() : role(-1) {}
29 inline QWidgetItemData(int r, const QVariant &v) : role(r), value(v) {}
30 int role;
32 inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; }
33};
35
36#ifndef QT_NO_DATASTREAM
37
38inline QDataStream &operator>>(QDataStream &in, QWidgetItemData &data)
39{
40 in >> data.role;
41 in >> data.value;
42 return in;
43}
44
45inline QDataStream &operator<<(QDataStream &out, const QWidgetItemData &data)
46{
47 out << data.role;
48 out << data.value;
49 return out;
50}
51
52#endif // QT_NO_DATASTREAM
53
54QT_END_NAMESPACE
55
56#endif // QWIDGETITEMDATA_P_H
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override
QModelIndex parent(const QModelIndex &child) const override
void ensureSorted(int column, Qt::SortOrder order, int start, int end, const QModelIndex &parent)
int rowCount(const QModelIndex &parent) const override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
bool insertColumns(int column, int count, const QModelIndex &) override
static bool itemGreaterThan(const std::pair< QTreeWidgetItem *, int > &left, const std::pair< QTreeWidgetItem *, int > &right)
QTreeWidget * view() const
void emitDataChanged(QTreeWidgetItem *item, int column, const QList< int > &roles)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
void endInsertItems()
Qt::DropActions supportedDragActions() const override
Returns the actions supported by the data in this model.
void itemChanged(QTreeWidgetItem *item)
void setColumnCount(int columns)
bool insertRows(int row, int count, const QModelIndex &) override
void sortItems(QList< QTreeWidgetItem * > *items, int column, Qt::SortOrder order)
QMimeData * internalMimeData() const
QTreeModel(QTreeModelPrivate &, QTreeWidget *parent=nullptr)
QTreeWidgetItem * item(const QModelIndex &index) const
Qt::DropActions supportedDropActions() const override
QMimeData * mimeData(const QModelIndexList &indexes) const override
Returns an object that contains serialized items of data corresponding to the list of indexes specifi...
QTreeModel(int columns=0, QTreeWidget *parent=nullptr)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void sort(int column, Qt::SortOrder order) override
QModelIndex createIndexFromItem(int row, int col, QTreeWidgetItem *item) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
QModelIndex index(int row, int column, const QModelIndex &parent) const override
bool clearItemData(const QModelIndex &index) override
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handles the data supplied by a drag and drop operation that ended with the given action.
static QList< QTreeWidgetItem * >::iterator sortedInsertionIterator(const QList< QTreeWidgetItem * >::iterator &begin, const QList< QTreeWidgetItem * >::iterator &end, Qt::SortOrder order, QTreeWidgetItem *item)
QStringList mimeTypes() const override
Returns the list of allowed MIME types.
QMap< int, QVariant > itemData(const QModelIndex &index) const override
Returns a map with values for all predefined roles in the model for the item at the given index.
QModelIndex index(const QTreeWidgetItem *item, int column) const
bool hasChildren(const QModelIndex &parent) const override
Returns {true} if parent has any children; otherwise returns {false}.
void timerEvent(QTimerEvent *) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void beginRemoveItems(QTreeWidgetItem *parent, int row, int count)
void beginInsertItems(QTreeWidgetItem *parent, int row, int count)
void endRemoveItems()
static bool itemLessThan(const std::pair< QTreeWidgetItem *, int > &left, const std::pair< QTreeWidgetItem *, int > &right)
QTreeWidgetItemPrivate(QTreeWidgetItem *item)
void sortChildren(int column, Qt::SortOrder order, bool climb)
void updateHiddenStatus(QTreeWidgetItem *item, bool inserting)
QTreeWidgetItem::ChildIndicatorPolicy policy
QTreeWidgetItem * q
void propagateDisabled(QTreeWidgetItem *item)
QModelIndex index(const QTreeWidgetItem *item, int column=0) const
void emitItemPressed(const QModelIndex &index)
QTreeModel * treeModel() const
void emitItemChanged(const QModelIndex &index)
std::array< QMetaObject::Connection, 12 > connections
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex &index)
void emitItemEntered(const QModelIndex &index)
void emitItemExpanded(const QModelIndex &index)
void emitItemActivated(const QModelIndex &index)
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void emitItemClicked(const QModelIndex &index)
QTreeWidgetItem * item(const QModelIndex &index) const
std::optional< Qt::DropActions > supportedDragActions
void emitItemCollapsed(const QModelIndex &index)
void emitItemDoubleClicked(const QModelIndex &index)
QWidgetItemData(int r, const QVariant &v)
bool operator==(const QWidgetItemData &other) const
QT_REQUIRE_CONFIG(treewidget)
QDataStream & operator<<(QDataStream &out, const QWidgetItemData &data)
QDataStream & operator>>(QDataStream &in, QWidgetItemData &data)
Q_DECLARE_TYPEINFO(QWidgetItemData, Q_RELOCATABLE_TYPE)