10#include <private/qtreewidget_p.h>
11#include <private/qwidgetitemdata_p.h>
12#include <private/qtreewidgetitemiterator_p.h>
14#include <QtCore/private/qduplicatetracker_p.h>
110 headerItem->view =
nullptr;
112 rootItem->view =
nullptr;
129 item->view =
nullptr;
132 rootItem->children.
clear();
133 sortPendingTimer.
stop();
150 headerItem->view =
view();
153 if (
count == columns)
156 if (columns <
count) {
158 headerItem->values.
resize(columns);
162 headerItem->values.
resize(columns);
163 for (
int i =
count;
i < columns; ++
i) {
181 if (!
index.isValid())
195 executePendingSort();
204 int guess =
item->d->rowGuess;
206 && par->children.
size() > guess
207 && par->children.
at(guess) == itm) {
226 executePendingSort();
229 if (
row < 0 || column < 0 || column >=
c)
233 if (parentItem && row < parentItem->childCount()) {
256 if (!
child.isValid())
259 if (!itm || itm == rootItem)
328 if (!
index.isValid())
348 if (!
index.isValid())
365 const auto beginIter = itm->values.
at(
index.column()).
cbegin();
366 const auto endIter = itm->values.
at(
index.column()).
cend();
379 QMap<int, QVariant> roles;
383 if (column < itm->
values.size()) {
392 if (displayValue.isValid())
396 if (checkValue.isValid())
443 for (
int i = oldCount;
i < oldCount +
count; ++
i) {
448 QStack<QTreeWidgetItem*> itemstack;
450 while (!itemstack.isEmpty()) {
452 QList<QTreeWidgetItem*>
children = par ? par->children : rootItem->children;
455 if (
child->children.size())
456 itemstack.push(
child);
479 child->view =
nullptr;
501 return headerItem->
data(section, role);
520 if (section < 0 || orientation != Qt::Horizontal || !headerItem || section >=
columnCount())
536 if (!
index.isValid())
537 return rootItem->
flags();
553 sortPendingTimer.
stop();
571 sortPendingTimer.
stop();
581 QList<QTreeWidgetItem*> lst = itm->children;
584 QList<QPair<QTreeWidgetItem *, int>> sorting(
count);
586 sorting[
i].first = lst.at(
start +
i);
591 std::stable_sort(sorting.begin(), sorting.end(),
compare);
596 bool changed =
false;
599 int oldRow = sorting.at(
i).second;
601 int tmpitepos = lit - lst.begin();
603 if (tmpitepos > lst.size())
605 lit = lst.begin() + tmpitepos;
608 int newRow = qMax<qsizetype>(lit - lst.begin(), 0);
610 if ((newRow < oldRow) && !(*
item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *
item ))
613 lit = lst.insert(lit,
item);
614 if (newRow != oldRow) {
620 newPersistentIndexes = oldPersistentIndexes;
623 int otherRow = sorting.at(
j).second;
624 if (oldRow < otherRow && newRow >= otherRow)
626 else if (oldRow > otherRow && newRow <= otherRow)
629 for (
int k = 0; k < newPersistentIndexes.size(); ++k) {
631 if (pi.parent() !=
parent)
633 int oldPersistentRow = pi.
row();
634 int newPersistentRow = oldPersistentRow;
635 if (oldPersistentRow == oldRow)
636 newPersistentRow = newRow;
637 else if (oldRow < oldPersistentRow && newRow >= oldPersistentRow)
638 newPersistentRow = oldPersistentRow - 1;
639 else if (oldRow > oldPersistentRow && newRow <= oldPersistentRow)
640 newPersistentRow = oldPersistentRow + 1;
641 if (newPersistentRow != oldPersistentRow)
642 newPersistentIndexes[k] =
createIndex(newPersistentRow,
643 pi.column(), pi.internalPointer());
665 const QPair<QTreeWidgetItem*,int> &
right)
680 const QPair<QTreeWidgetItem*,int> &
right)
702 return v->mimeTypes();
713 QList<QTreeWidgetItem *>
items;
714 std::transform(indexes.
begin(), indexes.
end(), std::back_inserter(
items),
724 cachedIndexes = indexes;
726 cachedIndexes.
clear();
751bool QTreeModel::isChanging()
const
754 return !
d->changes.isEmpty();
784 bottomRight = topLeft;
808 for (
int i = 0;
i < iterators.
size(); ++
i) {
811 iterators[
i]->d_func()->ensureValidIterator(
c);
829 QList<QPair<QTreeWidgetItem *, int>> sorting(
items->
size());
830 for (
int i = 0;
i < sorting.size(); ++
i) {
832 sorting[
i].second =
i;
837 std::stable_sort(sorting.begin(), sorting.end(),
compare);
842 for (
int r = 0;
r < sorting.size(); ++
r) {
843 int oldRow = sorting.at(
r).second;
848 for (
int c = 0;
c < colCount; ++
c) {
862 if (ev->timerId() == sortPendingTimer.
timerId()) {
863 executePendingSort();
1020 if (
this ==
model->headerItem) {
1043 if (
this ==
model->headerItem)
1044 return view->
header()->isHidden();
1045 if (view->d_func()->hiddenIndexes.isEmpty())
1048 return view->d_func()->
isRowHidden(view->d_func()->index(
this));
1066 view->
setExpanded(view->d_func()->index(
this), expand);
1083 return view->
isExpanded(view->d_func()->index(
this));
1416 model->rootItem->addChild(
this);
1438 model->rootItem->addChild(
this);
1457 model->rootItem->insertChild(
i,
this);
1520 int i = par->children.
indexOf(
this);
1525 if (!par->children.
isEmpty() && par->children.
at(
i) ==
this)
1530 if (
this ==
model->headerItem) {
1531 model->headerItem =
nullptr;
1535 model->beginRemoveItems(
nullptr,
i, 1);
1540 model->endRemoveItems();
1546 for (
int i = 0;
i < children.
size(); ++
i) {
1549 child->par =
nullptr;
1551 child->view =
nullptr;
1566 QStack<const QTreeWidgetItem*> stack;
1567 QStack<QTreeWidgetItem*> parentStack;
1569 parentStack.push(0);
1574 while (!stack.isEmpty()) {
1577 parent = parentStack.pop();
1590 for (
int i = 0;
i <
item->childCount(); ++
i) {
1591 stack.push(
item->child(
i));
1592 parentStack.push(
copy);
1645 itemFlags =
flags &
~Qt::ItemIsEnabled;
1649 if (changedState && changedExplicit) {
1650 QStack<QTreeWidgetItem*> parents;
1652 while (!parents.isEmpty()) {
1656 if (!
child->d->disabled) {
1657 parents.push(
child);
1662 child->itemChanged();
1675 QStack<QTreeWidgetItem *> parents;
1677 while (!parents.isEmpty()) {
1681 item->view->setRowHidden(
index.row(),
index.parent(), inserting);
1683 for (
int i = 0;
i < parent->children.
size(); ++
i) {
1685 parents.push(
child);
1695 QStack<QTreeWidgetItem*> parents;
1697 while (!parents.isEmpty()) {
1700 Qt::ItemFlags oldFlags = parent->itemFlags;
1704 parent->itemFlags = parent->itemFlags &
~Qt::ItemIsEnabled;
1705 if (parent->itemFlags != oldFlags)
1706 parent->itemChanged();
1709 for (
int i = 0;
i < parent->children.
size(); ++
i) {
1711 parents.push(
child);
1769 for (
int i = 0;
i < children.
size(); ++
i) {
1772 Qt::ItemFlags
f = itemFlags;
1773 itemFlags &=
~Qt::ItemIsAutoTristate;
1783 const QList<QWidgetItemData> column_values =
values.at(
column);
1784 for (
int i = 0;
i < column_values.size(); ++
i) {
1785 if (column_values.at(
i).role == role) {
1786 if (column_values.at(
i).value ==
value)
1807 : QList<int>({ role }));
1831 return childrenCheckState(
column);
1835 const QList<QWidgetItemData> &column_values =
values.at(
column);
1836 for (
const auto &column_value : column_values) {
1837 if (column_value.role == role)
1838 return column_value.value;
1858#ifndef QT_NO_DATASTREAM
1868 if (
in.version() < QDataStream::Qt_4_2) {
1911 itemFlags(
other.itemFlags)
1929 itemFlags =
other.itemFlags;
1942 child->d->rowGuess = children.
size() - 1;
1953 if (index < 0 || index > children.
size() ||
child ==
nullptr ||
child->view !=
nullptr ||
child->par !=
nullptr)
1958 if (
model->rootItem ==
this)
1959 child->par =
nullptr;
1964 if (!
model->sortPendingTimer.isActive())
1969 QStack<QTreeWidgetItem*> stack;
1971 while (!stack.isEmpty()) {
1974 i->values.reserve(cols);
1975 for (
int c = 0;
c <
i->children.size(); ++
c)
1976 stack.push(
i->children.at(
c));
1980 model->endInsertItems();
2011 model->skipPendingSort =
false;
2012 model->executePendingSort();
2018 item->par =
nullptr;
2019 QStack<QTreeWidgetItem*> stack;
2021 while (!stack.isEmpty()) {
2024 for (
int c = 0;
c <
i->children.size(); ++
c)
2025 stack.push(
i->children.at(
c));
2055 if (index < 0 || index > this->children.size() || children.isEmpty())
2059 for (
int n = 0;
n < children.size(); ++
n)
2064 QStack<QTreeWidgetItem*> stack;
2065 QList<QTreeWidgetItem*> itemsToInsert;
2066 for (
int n = 0;
n < children.size(); ++
n) {
2070 itemsToInsert.append(
child);
2071 if (view &&
model) {
2072 if (
child->childCount() == 0)
2078 child->par =
nullptr;
2082 if (!itemsToInsert.isEmpty()) {
2083 while (!stack.isEmpty()) {
2086 for (
int c = 0;
c <
i->children.size(); ++
c)
2087 stack.push(
i->children.at(
c));
2089 if (
model)
model->beginInsertItems(
this,
index, itemsToInsert.size());
2090 for (
int n = 0;
n < itemsToInsert.size(); ++
n) {
2108 QList<QTreeWidgetItem*> removed;
2109 if (children.
size() > 0) {
2116 model->executePendingSort();
2119 for (
int n = 0;
n < children.
size(); ++
n) {
2121 item->par =
nullptr;
2122 QStack<QTreeWidgetItem*> stack;
2124 while (!stack.isEmpty()) {
2127 for (
int c = 0;
c <
i->children.size(); ++
c)
2128 stack.push(
i->children.at(
c));
2148 for (;
it !=
q->children.
end(); ++
it) {
2168 if (
model->isChanging())
2171 int oldSortColumn = view->d_func()->explicitSortColumn;
2172 view->d_func()->explicitSortColumn =
column;
2176 view->d_func()->explicitSortColumn = oldSortColumn;
2191 bool checkedChildren =
false;
2192 bool uncheckedChildren =
false;
2193 for (
const auto *
child : children) {
2195 if (!
value.isValid())
2201 uncheckedChildren =
true;
2204 checkedChildren =
true;
2211 if (uncheckedChildren && checkedChildren)
2215 if (uncheckedChildren)
2217 else if (checkedChildren)
2243void QTreeWidgetItem::itemChanged()
2246 model->itemChanged(
this);
2252void QTreeWidgetItem::executePendingSort()
const
2255 model->executePendingSort();
2266 return (
v ? qobject_cast<QTreeModel*>(
v->model()) :
nullptr);
2270#ifndef QT_NO_DATASTREAM
2344 emit q->itemChanged(indexItem,
index.column());
2365 emit q->currentItemChanged(currentItem, previousItem);
2385 item->d->selected =
true;
2388 indices = deselected.indexes();
2391 item->d->selected =
false;
2394 emit q->itemSelectionChanged();
2401 && !
treeModel()->sortPendingTimer.isActive()) {
2616 d->clearConnections();
2628 return d->model->columnCount();
2640 d->treeModel()->setColumnCount(columns);
2657 return d->treeModel()->rootItem;
2670 return d->treeModel()->rootItem->child(
index);
2685 return d->treeModel()->rootItem->childCount();
2699 d->treeModel()->rootItem->insertChild(
index,
item);
2724 return d->treeModel()->rootItem->takeChild(
index);
2736 d->treeModel()->executePendingSort();
2737 return d->treeModel()->rootItem->children.indexOf(
item);
2752 d->treeModel()->rootItem->insertChildren(
index,
items);
2774 return d->treeModel()->headerItem;
2795 d->treeModel()->beginInsertColumns(
QModelIndex(), oldCount,
item->columnCount() - 1);
2796 else if (oldCount >
item->columnCount())
2797 d->treeModel()->beginRemoveColumns(
QModelIndex(),
item->columnCount(), oldCount - 1);
2798 delete d->treeModel()->headerItem;
2799 d->treeModel()->headerItem =
item;
2801 d->treeModel()->endInsertColumns();
2802 else if (oldCount >
item->columnCount())
2803 d->treeModel()->endRemoveColumns();
2822 for (
int i = 0;
i < labels.size(); ++
i)
2823 item->setText(
i, labels.at(
i));
2888 QItemSelectionModel::SelectionFlags command)
2891 d->selectionModel->setCurrentIndex(
d->index(
item,
column), command);
2943 return (
d->explicitSortColumn != -1
2944 ?
d->explicitSortColumn
3064 QList<QTreeWidgetItem*>
items;
3066 QDuplicateTracker<QTreeWidgetItem *> seen(indexes.
size());
3067 for (
const auto &
index : indexes) {
3069 if (
item->isHidden() || seen.hasSeen(
item))
3084 QList<QTreeWidgetItem*>
items;
3085 const int indexesSize = indexes.
size();
3087 for (
int i = 0;
i < indexesSize; ++
i)
3101 if (
item ==
d->treeModel()->headerItem)
3105 return d->item(above);
3116 if (
item ==
d->treeModel()->headerItem)
3120 return d->item(below);
3131 if (!newSelection.isEmpty())
3186 d->treeModel()->clear();
3197 return model()->QAbstractItemModel::mimeTypes();
3211 if (
d->treeModel()->cachedIndexes.isEmpty()) {
3212 QList<QModelIndex> indexes;
3215 qWarning(
"QTreeWidget::mimeData: Null-item passed");
3219 for (
int c = 0;
c <
item->values.size(); ++
c) {
3222 qWarning() <<
"QTreeWidget::mimeData: No index associated with item :" <<
item;
3228 return d->model->QAbstractItemModel::mimeData(indexes);
3230 return d->treeModel()->internalMimeData();
3248 return model()->QAbstractItemModel::dropMimeData(
data, action ,
index, 0, idx);
3285#if QT_CONFIG(draganddrop)
3287void QTreeWidget::dropEvent(QDropEvent *
event) {
3290 dragDropMode() == QAbstractItemView::InternalMove)) {
3295 if (!
event->isAccepted() &&
d->dropOn(
event, &
row, &col, &topIndex)) {
3297 QList<QPersistentModelIndex> indexes;
3298 const int indexesCount = idxs.size();
3299 indexes.reserve(indexesCount);
3300 for (
const auto &idx : idxs)
3303 if (indexes.contains(topIndex))
3310 QList<QTreeWidgetItem *> taken;
3311 for (
const auto &
index : indexes) {
3313 if (!parent || !parent->
parent()) {
3321 for (
int i = 0;
i < indexes.size(); ++
i) {
3324 if (topIndex.isValid()) {
3331 int r = dropRow.row() >= 0 ? dropRow.row() :
row;
3332 if (topIndex.isValid()) {
3345 if (
event->isAccepted())
3346 d->dropEventMoved =
true;
3349 QTreeView::dropEvent(
event);
3359 Q_ASSERT(!
"QTreeWidget::setModel() - Changing the model of the QTreeWidget is not allowed.");
3369 d->treeModel()->executePendingSort();
3378 q_func()->executePendingSort();
3383#include "moc_qtreewidget.cpp"
3384#include "moc_qtreewidget_p.cpp"
static bool variantLessThan(const QVariant &v1, const QVariant &v2)
struct QAbstractItemModelPrivate::Persistent persistent
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
void endResetModel()
Completes a model reset operation.
void columnsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been removed from the model.
void endRemoveRows()
Ends a row removal operation.
QModelIndexList persistentIndexList() const
void beginRemoveColumns(const QModelIndex &parent, int first, int last)
Begins a column removal operation.
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to)
void layoutAboutToBeChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
This signal is emitted whenever the data in an existing item changes.
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Returns an object that contains serialized items of data corresponding to the list of indexes specifi...
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
bool checkIndex(const QModelIndex &index, CheckIndexOptions options=CheckIndexOption::NoOption) const
void headerDataChanged(Qt::Orientation orientation, int first, int last)
This signal is emitted whenever a header is changed.
void beginInsertColumns(const QModelIndex &parent, int first, int last)
Begins a column insertion operation.
void endInsertRows()
Ends a row insertion operation.
void beginResetModel()
Begins a model reset operation.
void endRemoveColumns()
Ends a column removal operation.
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
Creates a model index for the given row and column with the internal pointer ptr.
void endInsertColumns()
Ends a column insertion operation.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.
QWidget * indexWidget(const QModelIndex &index) const
void activated(const QModelIndex &index)
This signal is emitted when the item specified by index is activated by the user.
QAbstractItemModel * model() const
Returns the model that this view is presenting.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
void doubleClicked(const QModelIndex &index)
This signal is emitted when a mouse button is double-clicked.
bool event(QEvent *event) override
\reimp
void entered(const QModelIndex &index)
This signal is emitted when the mouse cursor enters the item specified by index.
QModelIndex currentIndex() const
Returns the model index of the current item.
bool isPersistentEditorOpen(const QModelIndex &index) const
void setIndexWidget(const QModelIndex &index, QWidget *widget)
void scheduleDelayedItemsLayout()
Schedules a layout of the items in the view to be executed when the event processing starts.
void openPersistentEditor(const QModelIndex &index)
Opens a persistent editor on the item at the given index.
void pressed(const QModelIndex &index)
This signal is emitted when a mouse button is pressed.
ScrollHint
\value EnsureVisible Scroll to ensure that the item is visible.
void clicked(const QModelIndex &index)
This signal is emitted when a mouse button is left-clicked.
QItemSelectionModel * selectionModel() const
Returns the current selection model.
void closePersistentEditor(const QModelIndex &index)
Closes the persistent editor for the item at the given index.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the data in row and column with parent.
int timerId() const noexcept
Returns the timer's ID.
void stop()
Stops the timer.
\inmodule QtCore\reentrant
Type type() const
Returns the event type.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This signal is emitted whenever the selection changes.
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This signal is emitted whenever the current item changes.
QModelIndexList selectedIndexes
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
virtual void clear()
Clears the selection model.
Q_CORE_EXPORT QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
qsizetype size() const noexcept
bool isEmpty() const noexcept
iterator erase(const_iterator begin, const_iterator end)
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
void reserve(qsizetype size)
void replace(qsizetype i, parameter_type t)
void resize(qsizetype size)
const_iterator cend() const noexcept
void append(parameter_type t)
const_iterator cbegin() const noexcept
constexpr int row() const noexcept
Returns the row this model index refers to.
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
constexpr int column() const noexcept
Returns the column this model index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
const QObjectList & children() const
Returns a list of child objects.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
bool signalsBlocked() const noexcept
Returns true if signals are blocked; otherwise returns false.
QScopedPointer< QObjectData > d_ptr
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
T * data() const noexcept
Returns the value of the pointer referenced by this object.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
\reimp
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool operator()(QTreeWidgetItem *i1, QTreeWidgetItem *i2) const
bool operator()(QTreeWidgetItem *i1, QTreeWidgetItem *i2) const
void executePendingOperations() const override
see QTBUG-94546
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) 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
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 itemChanged(QTreeWidgetItem *item)
void setColumnCount(int columns)
friend class QTreeWidgetItem
bool insertRows(int row, int count, const QModelIndex &) override
void sortItems(QList< QTreeWidgetItem * > *items, int column, Qt::SortOrder order)
QMimeData * internalMimeData() const
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
static bool itemLessThan(const QPair< QTreeWidgetItem *, int > &left, const QPair< QTreeWidgetItem *, int > &right)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Qt::ItemFlags flags(const QModelIndex &index) const override
\reimp
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)
static bool itemGreaterThan(const QPair< QTreeWidgetItem *, int > &left, const QPair< QTreeWidgetItem *, int > &right)
The QTreeView class provides a default model/view implementation of a tree view.
bool isSortingEnabled() const
void expand(const QModelIndex &index)
Expands the model item specified by the index.
void setSelectionModel(QItemSelectionModel *selectionModel) override
\reimp
void collapse(const QModelIndex &index)
Collapses the model item specified by the index.
void setModel(QAbstractItemModel *model) override
\reimp
QModelIndex indexBelow(const QModelIndex &index) const
Returns the model index of the item below index.
bool isExpanded(const QModelIndex &index) const
Returns true if the model item index is expanded; otherwise returns false.
QHeaderView * header() const
Returns the header for the tree view.
void setExpanded(const QModelIndex &index, bool expand)
Sets the item referred to by index to either collapse or expanded, depending on the value of expanded...
QModelIndex indexAt(const QPoint &p) const override
\reimp
QModelIndex indexAbove(const QModelIndex &index) const
Returns the model index of the item above index.
void setFirstColumnSpanned(int row, const QModelIndex &parent, bool span)
QModelIndexList selectedIndexes() const override
\reimp
void collapsed(const QModelIndex &index)
This signal is emitted when the item specified by index is collapsed.
void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible) override
Scroll the contents of the tree view until the given model item index is visible.
void setRowHidden(int row, const QModelIndex &parent, bool hide)
If hide is true the row with the given parent is hidden, otherwise the row is shown.
bool isRowHidden(int row, const QModelIndex &parent) const
Returns true if the item in the given row of the parent is hidden; otherwise returns false.
QRect visualRect(const QModelIndex &index) const override
Returns the rectangle on the viewport occupied by the item at index.
bool isFirstColumnSpanned(int row, const QModelIndex &parent) const
void expanded(const QModelIndex &index)
This signal is emitted when the item specified by index is expanded.
bool isValid() const
Returns true if the storage type of this variant is not QMetaType::UnknownType; otherwise returns fal...
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
struct wl_display * display
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection * connection
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
GLint GLfloat GLfloat GLfloat v2
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei const GLchar ** strings
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLsizei GLenum const void * indices
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
GLfixed GLfixed GLint GLint order
const QQuickItem * rootItem(const I &item)
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
static QList< QVariant > toList(char **buf, int count)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
static int compare(quint64 a, quint64 b)
QSqlQueryModel * model
[16]
QTextStream out(stdout)
[7]
selection select(topLeft, bottomRight)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
qsizetype lastIndexOf(const AT &t, qsizetype from=-1) const noexcept