📄 qtreewidget.cpp
字号:
/*! \fn int QTreeWidgetItem::type() const Returns the type passed to the QTreeWidgetItem constructor.*//*! \fn void QTreeWidgetItem::sortChildren(int column, Qt::SortOrder order) \since 4.2 Sorts the children of the item using the given \a order, by the values in the given \a column.*//*! \fn QTreeWidget *QTreeWidgetItem::treeWidget() const Returns the tree widget that contains the item.*//*! \fn void QTreeWidgetItem::setSelected(bool select) \since 4.2 Sets the selected state of the item to \a select. \sa isSelected()*//*! \fn bool QTreeWidgetItem::isSelected() const \since 4.2 Returns true if the item is selected, otherwise returns false. \sa setSelected()*//*! \fn void QTreeWidgetItem::setHidden(bool hide) \since 4.2 Hides the item if \a hide is true, otherwise shows the item. \sa isHidden()*//*! \fn bool QTreeWidgetItem::isHidden() const \since 4.2 Returns true if the item is hidden, otherwise returns false. \sa setHidden()*//*! \fn void QTreeWidgetItem::setExpanded(bool expand) \since 4.2 Expands the item if \a expand is true, otherwise collapses the item. \warning The QTreeWidgetItem must be added to the QTreeWidget before calling this function. \sa isExpanded()*//*! \fn bool QTreeWidgetItem::isExpanded() const \since 4.2 Returns true if the item is expanded, otherwise returns false. \sa setExpanded()*//*! \fn void QTreeWidgetItem::setFirstColumnSpanned(bool span) \since 4.3 Sets the first section to span all columns if \a span is true; otherwise all item sections are shown. \sa isFirstColumnSpanned()*//*! \fn bool QTreeWidgetItem::isFirstColumnSpanned() const \since 4.3 Returns true if the item is spanning all the columns in a row; otherwise returns false. \sa setFirstColumnSpanned()*//*! \fn QString QTreeWidgetItem::text(int column) const Returns the text in the specified \a column. \sa setText()*//*! \fn void QTreeWidgetItem::setText(int column, const QString &text) Sets the text to be displayed in the given \a column to the given \a text. \sa text() setFont() setForeground()*//*! \fn QIcon QTreeWidgetItem::icon(int column) const Returns the icon that is displayed in the specified \a column. \sa setIcon(), {QAbstractItemView::iconSize}{iconSize}*//*! \fn void QTreeWidgetItem::setIcon(int column, const QIcon &icon) Sets the icon to be displayed in the given \a column to \a icon. \sa icon(), setText(), {QAbstractItemView::iconSize}{iconSize}*//*! \fn QString QTreeWidgetItem::statusTip(int column) const Returns the status tip for the contents of the given \a column. \sa setStatusTip()*//*! \fn void QTreeWidgetItem::setStatusTip(int column, const QString &statusTip) Sets the status tip for the given \a column to the given \a statusTip. QTreeWidget mouse tracking needs to be enabled for this feature to work. \sa statusTip() setToolTip() setWhatsThis()*//*! \fn QString QTreeWidgetItem::toolTip(int column) const Returns the tool tip for the given \a column. \sa setToolTip()*//*! \fn void QTreeWidgetItem::setToolTip(int column, const QString &toolTip) Sets the tooltip for the given \a column to \a toolTip. \sa toolTip() setStatusTip() setWhatsThis()*//*! \fn QString QTreeWidgetItem::whatsThis(int column) const Returns the "What's This?" help for the contents of the given \a column. \sa setWhatsThis()*//*! \fn void QTreeWidgetItem::setWhatsThis(int column, const QString &whatsThis) Sets the "What's This?" help for the given \a column to \a whatsThis. \sa whatsThis() setStatusTip() setToolTip()*//*! \fn QFont QTreeWidgetItem::font(int column) const Returns the font used to render the text in the specified \a column. \sa setFont()*//*! \fn void QTreeWidgetItem::setFont(int column, const QFont &font) Sets the font used to display the text in the given \a column to the given \a font. \sa font() setText() setForeground()*//*! \fn QColor QTreeWidgetItem::backgroundColor(int column) const \obsolete This function is deprecated. Use background() instead.*//*! \fn void QTreeWidgetItem::setBackgroundColor(int column, const QColor &color) \obsolete This function is deprecated. Use setBackground() instead.*//*! \fn QBrush QTreeWidgetItem::background(int column) const \since 4.2 Returns the brush used to render the background of the specified \a column. \sa foreground()*//*! \fn void QTreeWidgetItem::setBackground(int column, const QBrush &brush) \since 4.2 Sets the background brush of the label in the given \a column to the specified \a brush. \sa setForeground()*//*! \fn QColor QTreeWidgetItem::textColor(int column) const \obsolete This function is deprecated. Use foreground() instead.*//*! \fn void QTreeWidgetItem::setTextColor(int column, const QColor &color) \obsolete This function is deprecated. Use setForeground() instead.*//*! \fn QBrush QTreeWidgetItem::foreground(int column) const \since 4.2 Returns the brush used to render the foreground (e.g. text) of the specified \a column. \sa background()*//*! \fn void QTreeWidgetItem::setForeground(int column, const QBrush &brush) \since 4.2 Sets the foreground brush of the label in the given \a column to the specified \a brush. \sa setBackground()*//*! \fn Qt::CheckState QTreeWidgetItem::checkState(int column) const Returns the check state of the label in the given \a column. \sa Qt::CheckState*//*! \fn void QTreeWidgetItem::setCheckState(int column, Qt::CheckState state) Sets the item in the given \a column check state to be \a state. \sa checkState()*//*! \fn QSize QTreeWidgetItem::sizeHint(int column) const \since 4.1 Returns the size hint set for the tree item in the given \a column (see \l{QSize}).*//*! \fn void QTreeWidgetItem::setSizeHint(int column, const QSize &size) \since 4.1 Sets the size hint for the tree item in the given \a column to be \a size. If no size hint is set, the item delegate will compute the size hint based on the item data.*//*! \fn QTreeWidgetItem *QTreeWidgetItem::parent() const Returns the item's parent. \sa child()*//*! \fn QTreeWidgetItem *QTreeWidgetItem::child(int index) const Returns the item at the given \a index in the list of the item's children. \sa parent()*//*! \fn int QTreeWidgetItem::childCount() const Returns the number of child items.*//*! \fn int QTreeWidgetItem::columnCount() const Returns the number of columns in the item.*//*! \fn int QTreeWidgetItem::textAlignment(int column) const Returns the text alignment for the label in the given \a column (see \l{Qt::AlignmentFlag}).*//*! \fn void QTreeWidgetItem::setTextAlignment(int column, int alignment) Sets the text alignment for the label in the given \a column to the \a alignment specified (see \l{Qt::AlignmentFlag}).*//*! \fn int QTreeWidgetItem::indexOfChild(QTreeWidgetItem *child) const Returns the index of the given \a child in the item's list of children.*//*! Constructs a tree widget item of the specified \a type. The item must be inserted into a tree widget. \sa type()*/QTreeWidgetItem::QTreeWidgetItem(int type) : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), itemFlags(Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled){}/*! Constructs a tree widget item of the specified \a type. The item must be inserted into a tree widget. The given list of \a strings will be set as the item text for each column in the item. \sa type()*/QTreeWidgetItem::QTreeWidgetItem(const QStringList &strings, int type) : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), itemFlags(Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled){ for (int i = 0; i < strings.count(); ++i) setText(i, strings.at(i));}/*! \fn QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *parent, int type) Constructs a tree widget item of the specified \a type and appends it to the items in the given \a parent. \sa type()*/QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, int type) : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), itemFlags(Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled){ if (view && view->model()) { QTreeModel *model = ::qobject_cast<QTreeModel*>(view->model()); model->rootItem->addChild(this); values.reserve(model->headerItem->columnCount()); model->executePendingSort(); }}/*! \fn QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *parent, const QStringList &strings, int type) Constructs a tree widget item of the specified \a type and appends it to the items in the given \a parent. The given list of \a strings will be set as the item text for each column in the item. \sa type()*/QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, const QStringList &strings, int type) : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), itemFlags(Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled){ for (int i = 0; i < strings.count(); ++i) setText(i, strings.at(i)); if (view && view->model()) { QTreeModel *model = ::qobject_cast<QTreeModel*>(view->model()); model->rootItem->addChild(this); values.reserve(model->headerItem->columnCount()); model->executePendingSort(); }}/*! \fn QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *parent, QTreeWidgetItem *preceding, int type) Constructs a tree widget item of the specified \a type and inserts it into the given \a parent after the \a preceding item. \sa type()*/QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, QTreeWidgetItem *after, int type) : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), itemFlags(Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled){ if (view) { QTreeModel *model = ::qobject_cast<QTreeModel*>(view->model()); if (model) { int i = model->rootItem->indexOfChild(after) + 1; model->rootItem->insertChild(i, this);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -