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
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
23
25{
26public:
27 inline QWidgetItemData() : role(-1) {}
28 inline QWidgetItemData(int r, const QVariant &v) : role(r), value(v) {}
29 int role;
31 inline bool operator==(const QWidgetItemData &other) const { return role == other.role && value == other.value; }
32};
34
35#ifndef QT_NO_DATASTREAM
36
37inline QDataStream &operator>>(QDataStream &in, QWidgetItemData &data)
38{
39 in >> data.role;
40 in >> data.value;
41 return in;
42}
43
44inline 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
53QT_END_NAMESPACE
54
55#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
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(treewidget)
QDataStream & operator<<(QDataStream &out, const QWidgetItemData &data)
QDataStream & operator>>(QDataStream &in, QWidgetItemData &data)
Q_DECLARE_TYPEINFO(QWidgetItemData, Q_RELOCATABLE_TYPE)