CopperSpice API  1.9.2
QTreeWidget Class Reference

The QTreeWidget class provides a tree view that uses a predefined tree model. More...

Inheritance diagram for QTreeWidget:
QTreeView QAbstractItemView QAbstractScrollArea QFrame QWidget QObject QPaintDevice

Public Signals

void currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *previous)
 
void itemActivated (QTreeWidgetItem *item, int column)
 
void itemChanged (QTreeWidgetItem *item, int column)
 
void itemClicked (QTreeWidgetItem *item, int column)
 
void itemCollapsed (QTreeWidgetItem *item)
 
void itemDoubleClicked (QTreeWidgetItem *item, int column)
 
void itemEntered (QTreeWidgetItem *item, int column)
 
void itemExpanded (QTreeWidgetItem *item)
 
void itemPressed (QTreeWidgetItem *item, int column)
 
void itemSelectionChanged ()
 
- Public Signals inherited from QTreeView
void collapsed (const QModelIndex &index)
 
void expanded (const QModelIndex &index)
 
- Public Signals inherited from QAbstractItemView
void activated (const QModelIndex &index)
 
void clicked (const QModelIndex &index)
 
void doubleClicked (const QModelIndex &index)
 
void entered (const QModelIndex &index)
 
void iconSizeChanged (const QSize &size)
 
void pressed (const QModelIndex &index)
 
void viewportEntered ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void clear ()
 
void collapseItem (const QTreeWidgetItem *item)
 
void expandItem (const QTreeWidgetItem *item)
 
void scrollToItem (const QTreeWidgetItem *item, QAbstractItemView::ScrollHint hint=EnsureVisible)
 
- Public Slots inherited from QTreeView
void collapse (const QModelIndex &index)
 
void collapseAll ()
 
void expand (const QModelIndex &index)
 
void expandAll ()
 
void expandToDepth (int depth)
 
void hideColumn (int column)
 
void resizeColumnToContents (int column)
 
void showColumn (int column)
 
void sortByColumn (int column)
 
- Public Slots inherited from QAbstractItemView
void clearSelection ()
 
void edit (const QModelIndex &index)
 
virtual void reset ()
 
void scrollToBottom ()
 
void scrollToTop ()
 
virtual void selectAll ()
 
void setCurrentIndex (const QModelIndex &index)
 
virtual void setRootIndex (const QModelIndex &index)
 
void update (const QModelIndex &index)
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QTreeWidget (QWidget *parent=nullptr)
 
 ~QTreeWidget ()
 
void addTopLevelItem (QTreeWidgetItem *item)
 
void addTopLevelItems (const QList< QTreeWidgetItem * > &items)
 
void closePersistentEditor (QTreeWidgetItem *item, int column=0)
 
int columnCount () const
 
int currentColumn () const
 
QTreeWidgetItemcurrentItem () const
 
void editItem (QTreeWidgetItem *item, int column=0)
 
QList< QTreeWidgetItem * > findItems (const QString &text, Qt::MatchFlags flags, int column=0) const
 
QTreeWidgetItemheaderItem () const
 
int indexOfTopLevelItem (QTreeWidgetItem *item) const
 
void insertTopLevelItem (int index, QTreeWidgetItem *item)
 
void insertTopLevelItems (int index, const QList< QTreeWidgetItem * > &items)
 
QTreeWidgetIteminvisibleRootItem () const
 
bool isFirstItemColumnSpanned (const QTreeWidgetItem *item) const
 
bool isItemExpanded (const QTreeWidgetItem *item) const
 
bool isItemHidden (const QTreeWidgetItem *item) const
 
bool isItemSelected (const QTreeWidgetItem *item) const
 
QTreeWidgetItemitemAbove (const QTreeWidgetItem *item) const
 
QTreeWidgetItemitemAt (const QPoint &p) const
 
QTreeWidgetItemitemAt (int x, int y) const
 
QTreeWidgetItemitemBelow (const QTreeWidgetItem *item) const
 
QWidgetitemWidget (QTreeWidgetItem *item, int column) const
 
void openPersistentEditor (QTreeWidgetItem *item, int column=0)
 
void removeItemWidget (QTreeWidgetItem *item, int column)
 
QList< QTreeWidgetItem * > selectedItems () const
 
void setColumnCount (int columns)
 
void setCurrentItem (QTreeWidgetItem *item)
 
void setCurrentItem (QTreeWidgetItem *item, int column)
 
void setCurrentItem (QTreeWidgetItem *item, int column, QItemSelectionModel::SelectionFlags command)
 
void setFirstItemColumnSpanned (const QTreeWidgetItem *item, bool span)
 
void setHeaderItem (QTreeWidgetItem *item)
 
void setHeaderLabel (const QString &label)
 
void setHeaderLabels (const QStringList &labels)
 
void setItemExpanded (const QTreeWidgetItem *item, bool expand)
 
void setItemHidden (const QTreeWidgetItem *item, bool hide)
 
void setItemSelected (const QTreeWidgetItem *item, bool select)
 
void setItemWidget (QTreeWidgetItem *item, int column, QWidget *widget)
 
void setSelectionModel (QItemSelectionModel *selectionModel) override
 
int sortColumn () const
 
void sortItems (int column, Qt::SortOrder order)
 
QTreeWidgetItemtakeTopLevelItem (int index)
 
QTreeWidgetItemtopLevelItem (int index) const
 
int topLevelItemCount () const
 
QRect visualItemRect (const QTreeWidgetItem *item) const
 
- Public Methods inherited from QTreeView
 QTreeView (QWidget *parent=nullptr)
 
 ~QTreeView ()
 
bool allColumnsShowFocus () const
 
int autoExpandDelay () const
 
int columnAt (int x) const
 
int columnViewportPosition (int column) const
 
int columnWidth (int column) const
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
 
bool expandsOnDoubleClick () const
 
QHeaderViewheader () const
 
int indentation () const
 
QModelIndex indexAbove (const QModelIndex &index) const
 
QModelIndex indexAt (const QPoint &point) const override
 
QModelIndex indexBelow (const QModelIndex &index) const
 
bool isAnimated () const
 
bool isColumnHidden (int column) const
 
bool isExpanded (const QModelIndex &index) const
 
bool isFirstColumnSpanned (int row, const QModelIndex &parent) const
 
bool isHeaderHidden () const
 
bool isRowHidden (int row, const QModelIndex &parent) const
 
bool isSortingEnabled () const
 
bool itemsExpandable () const
 
void keyboardSearch (const QString &search) override
 
void reset () override
 
void resetIndentation ()
 
bool rootIsDecorated () const
 
void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override
 
void selectAll () override
 
void setAllColumnsShowFocus (bool enable)
 
void setAnimated (bool enable)
 
void setAutoExpandDelay (int delay)
 
void setColumnHidden (int column, bool hide)
 
void setColumnWidth (int column, int width)
 
void setExpanded (const QModelIndex &index, bool expanded)
 
void setExpandsOnDoubleClick (bool enable)
 
void setFirstColumnSpanned (int row, const QModelIndex &parent, bool span)
 
void setHeader (QHeaderView *header)
 
void setHeaderHidden (bool hide)
 
void setIndentation (int i)
 
void setItemsExpandable (bool enable)
 
void setRootIndex (const QModelIndex &index) override
 
void setRootIsDecorated (bool show)
 
void setRowHidden (int row, const QModelIndex &parent, bool hide)
 
void setSortingEnabled (bool enable)
 
void setTreePosition (int logicalIndex)
 
void setUniformRowHeights (bool uniform)
 
void setWordWrap (bool on)
 
void sortByColumn (int column, Qt::SortOrder order)
 
int treePosition () const
 
bool uniformRowHeights () const
 
QRect visualRect (const QModelIndex &index) const override
 
bool wordWrap () const
 
- Public Methods inherited from QAbstractItemView
 QAbstractItemView (QWidget *parent=nullptr)
 
 ~QAbstractItemView ()
 
bool alternatingRowColors () const
 
int autoScrollMargin () const
 
void closePersistentEditor (const QModelIndex &index)
 
QModelIndex currentIndex () const
 
Qt::DropAction defaultDropAction () const
 
DragDropMode dragDropMode () const
 
bool dragDropOverwriteMode () const
 
bool dragEnabled () const
 
EditTriggers editTriggers () const
 
bool hasAutoScroll () const
 
ScrollMode horizontalScrollMode () const
 
QSize iconSize () const
 
QWidgetindexWidget (const QModelIndex &index) const
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
QAbstractItemDelegateitemDelegate () const
 
QAbstractItemDelegateitemDelegate (const QModelIndex &index) const
 
QAbstractItemDelegateitemDelegateForColumn (int column) const
 
QAbstractItemDelegateitemDelegateForRow (int row) const
 
QAbstractItemModelmodel () const
 
void openPersistentEditor (const QModelIndex &index)
 
QModelIndex rootIndex () const
 
QAbstractItemView::SelectionBehavior selectionBehavior () const
 
QAbstractItemView::SelectionMode selectionMode () const
 
QItemSelectionModelselectionModel () const
 
void setAlternatingRowColors (bool enable)
 
void setAutoScroll (bool enable)
 
void setAutoScrollMargin (int margin)
 
void setDefaultDropAction (Qt::DropAction dropAction)
 
void setDragDropMode (DragDropMode behavior)
 
void setDragDropOverwriteMode (bool overwrite)
 
void setDragEnabled (bool enable)
 
void setDropIndicatorShown (bool enable)
 
void setEditTriggers (EditTriggers triggers)
 
void setHorizontalScrollMode (ScrollMode mode)
 
void setIconSize (const QSize &size)
 
void setIndexWidget (const QModelIndex &index, QWidget *widget)
 
void setItemDelegate (QAbstractItemDelegate *delegate)
 
void setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate)
 
void setItemDelegateForRow (int row, QAbstractItemDelegate *delegate)
 
void setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior)
 
void setSelectionMode (QAbstractItemView::SelectionMode mode)
 
void setTabKeyNavigation (bool enable)
 
void setTextElideMode (Qt::TextElideMode mode)
 
void setVerticalScrollMode (ScrollMode mode)
 
bool showDropIndicator () const
 
QSize sizeHintForIndex (const QModelIndex &index) const
 
virtual int sizeHintForRow (int row) const
 
bool tabKeyNavigation () const
 
Qt::TextElideMode textElideMode () const
 
ScrollMode verticalScrollMode () const
 
- Public Methods inherited from QAbstractScrollArea
 QAbstractScrollArea (QWidget *parent=nullptr)
 
 ~QAbstractScrollArea ()
 
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
 
QWidgetcornerWidget () const
 
QScrollBarhorizontalScrollBar () const
 
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
 
QSize maximumViewportSize () const
 
QSize minimumSizeHint () const override
 
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
 
void setCornerWidget (QWidget *widget)
 
void setHorizontalScrollBar (QScrollBar *scrollBar)
 
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
 
virtual void setupViewport (QWidget *viewport)
 
void setVerticalScrollBar (QScrollBar *scrollBar)
 
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setViewport (QWidget *widget)
 
SizeAdjustPolicy sizeAdjustPolicy () const
 
QSize sizeHint () const override
 
QScrollBarverticalScrollBar () const
 
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
 
QWidgetviewport () const
 
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QFrame ()
 
QRect frameRect () const
 
Shadow frameShadow () const
 
Shape frameShape () const
 
int frameStyle () const
 
int frameWidth () const
 
int lineWidth () const
 
int midLineWidth () const
 
void setFrameRect (const QRect &rect)
 
void setFrameShadow (Shadow value)
 
void setFrameShape (Shape value)
 
void setFrameStyle (int style)
 
void setLineWidth (int width)
 
void setMidLineWidth (int width)
 
QSize sizeHint () const override
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Methods

void dropEvent (QDropEvent *event) override
 
virtual bool dropMimeData (QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action)
 
bool event (QEvent *event) override
 
QModelIndex indexFromItem (QTreeWidgetItem *item, int column=0) const
 
QTreeWidgetItemitemFromIndex (const QModelIndex &index) const
 
virtual QMimeDatamimeData (const QList< QTreeWidgetItem * > &items) const
 
virtual QStringList mimeTypes () const
 
virtual Qt::DropActions supportedDropActions () const
 
- Protected Methods inherited from QTreeView
void currentChanged (const QModelIndex &current, const QModelIndex &previous) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
virtual void drawBranches (QPainter *painter, const QRect &rect, const QModelIndex &index) const
 
virtual void drawRow (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 
void drawTree (QPainter *painter, const QRegion &region) const
 
int horizontalOffset () const override
 
void horizontalScrollbarAction (int action) override
 
int indexRowSizeHint (const QModelIndex &index) const
 
bool isIndexHidden (const QModelIndex &index) const override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 
void paintEvent (QPaintEvent *event) override
 
int rowHeight (const QModelIndex &index) const
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override
 
void rowsInserted (const QModelIndex &parent, int start, int end) override
 
void scrollContentsBy (int dx, int dy) override
 
QModelIndexList selectedIndexes () const override
 
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override
 
int sizeHintForColumn (int column) const override
 
void timerEvent (QTimerEvent *event) override
 
void updateGeometries () override
 
int verticalOffset () const override
 
bool viewportEvent (QEvent *event) override
 
QSize viewportSizeHint () const override
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 
- Protected Methods inherited from QAbstractItemView
QPoint dirtyRegionOffset () const
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
DropIndicatorPosition dropIndicatorPosition () const
 
virtual bool edit (const QModelIndex &index, EditTrigger trigger, QEvent *event)
 
bool event (QEvent *event) override
 
void executeDelayedItemsLayout ()
 
void focusInEvent (QFocusEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void focusOutEvent (QFocusEvent *event) override
 
int horizontalStepsPerItem () const
 
void inputMethodEvent (QInputMethodEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void scheduleDelayedItemsLayout ()
 
void scrollDirtyRegion (int dx, int dy)
 
virtual QItemSelectionModel::SelectionFlags selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const
 
void setDirtyRegion (const QRegion &region)
 
void setHorizontalStepsPerItem (int steps)
 
void setState (State state)
 
void setVerticalStepsPerItem (int steps)
 
virtual void startDrag (Qt::DropActions supportedActions)
 
State state () const
 
void timerEvent (QTimerEvent *event) override
 
int verticalStepsPerItem () const
 
virtual QStyleOptionViewItem viewOptions () const
 
- Protected Methods inherited from QAbstractScrollArea
void contextMenuEvent (QContextMenuEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
bool event (QEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void setViewportMargins (const QMargins &margins)
 
void setViewportMargins (int left, int top, int right, int bottom)
 
QMargins viewportMargins () const
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QFrame
void changeEvent (QEvent *event) override
 
void drawFrame (QPainter *painter)
 
bool event (QEvent *event) override
 
void initStyleOption (QStyleOptionFrame *option) const
 
void paintEvent (QPaintEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
virtual void hideEvent (QHideEvent *event)
 
void initPainter (QPainter *painter) const override
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void showEvent (QShowEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 columnCount
 
 topLevelItemCount
 
- Properties inherited from QTreeView
 allColumnsShowFocus
 
 animated
 
 autoExpandDelay
 
 expandsOnDoubleClick
 
 headerHidden
 
 indentation
 
 itemsExpandable
 
 rootIsDecorated
 
 sortingEnabled
 
 uniformRowHeights
 
 wordWrap
 
- Properties inherited from QAbstractItemView
 alternatingRowColors
 
 autoScroll
 
 autoScrollMargin
 
 defaultDropAction
 
 dragDropMode
 
 dragDropOverwriteMode
 
 dragEnabled
 
 editTriggers
 
 horizontalScrollMode
 
 iconSize
 
 selectionBehavior
 
 selectionMode
 
 showDropIndicator
 
 tabKeyNavigation
 
 textElideMode
 
 verticalScrollMode
 
- Properties inherited from QAbstractScrollArea
 horizontalScrollBarPolicy
 
 verticalScrollBarPolicy
 
- Properties inherited from QFrame
 frameRect
 
 frameShadow
 
 frameShape
 
 frameWidth
 
 lineWidth
 
 midLineWidth
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Friends

class QTreeWidgetItem
 

Additional Inherited Members

- Public Typedefs inherited from QAbstractItemView
using EditTriggers = QFlags< EditTrigger >
 
- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
 
- Public Types inherited from QAbstractItemView
enum  DragDropMode
 
enum  EditTrigger
 
enum  ScrollHint
 
enum  ScrollMode
 
enum  SelectionBehavior
 
enum  SelectionMode
 
- Public Types inherited from QFrame
enum  Shadow
 
enum  Shape
 
enum  StyleMask
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Types inherited from QAbstractItemView
enum  CursorAction
 
enum  DropIndicatorPosition
 
enum  State
 
- Protected Slots inherited from QTreeView
void columnCountChanged (int oldCount, int newCount)
 
void columnMoved ()
 
void columnResized (int column, int oldSize, int newSize)
 
void rowsRemoved (const QModelIndex &parent, int start, int end)
 
- Protected Slots inherited from QAbstractItemView
virtual void closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
 
virtual void commitData (QWidget *editor)
 
virtual void currentChanged (const QModelIndex &current, const QModelIndex &previous)
 
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
 
virtual void editorDestroyed (QObject *editor)
 
virtual void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
virtual void rowsInserted (const QModelIndex &parent, int start, int end)
 
virtual void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
virtual void updateGeometries ()
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Detailed Description

The QTreeWidget class provides a tree view which uses a predefined tree model which can not be changed. This class offers a simple API and is less flexible than its counter part Model/View QTreeView class. In most cases using QTreeView with a standard item model will be a better approach.

Example

The following example shows how to create a tree widget.

QTreeWidget *treeWidget = new QTreeWidget();
treeWidget->setColumnCount(1);
for (int i = 0; i < 10; ++i) {
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").formatArg(i))));
}
treeWidget->insertTopLevelItems(0, items);

Before items can be added to the tree widget the number of columns must be set with setColumnCount(). This allows each item to have one or more labels or other decorations. The number of columns in use can be found with the columnCount() method.

The tree can have a header that contains a section for each column in the widget. It is easiest to set up the labels for each section by supplying a list of strings with setHeaderLabels(), but a custom header can be constructed with a QTreeWidgetItem and inserted into the tree with the setHeaderItem() method.

The items in the tree can be sorted by column according to a predefined sort order. If sorting is enabled the user can sort the items by clicking on a column header. Sorting can be enabled or disabled by calling setSortingEnabled(). The isSortingEnabled() function indicates whether sorting is enabled.

See also
QTreeWidgetItem, QTreeWidgetItemIterator, QTreeView, Model/View Architecture

Constructor & Destructor Documentation

QTreeWidget::QTreeWidget ( QWidget parent = nullptr)
explicit

Constructs a tree widget with the given parent.

QTreeWidget::~QTreeWidget ( )

Destroys the tree widget and all its items.

Method Documentation

void QTreeWidget::addTopLevelItem ( QTreeWidgetItem item)

Appends the item as a top level item in the widget.

See also
insertTopLevelItem()
void QTreeWidget::addTopLevelItems ( const QList< QTreeWidgetItem * > &  items)

Appends the list of items as a top level items in the widget.

See also
insertTopLevelItems()
void QTreeWidget::clear ( )
slot

Clears the tree widget by removing all of its items and selections.

Since each item is removed from the tree widget before being deleted, the return value of QTreeWidgetItem::treeWidget() will be invalid when called from an item's destructor.

See also
takeTopLevelItem(), topLevelItemCount(), columnCount()
void QTreeWidget::closePersistentEditor ( QTreeWidgetItem item,
int  column = 0 
)

Closes the persistent editor for the item in the given column. This method has no effect if no persistent editor is open for this combination of item and column.

See also
openPersistentEditor()
void QTreeWidget::collapseItem ( const QTreeWidgetItem item)
slot

Closes the item. This causes the tree containing the child items to be collapsed.

See also
expandItem(), currentItem(), itemAt(), topLevelItem()
int QTreeWidget::columnCount ( ) const

Returns the value of the property.

int QTreeWidget::currentColumn ( ) const

Returns the current column in the tree widget.

See also
setCurrentItem(), columnCount()
QTreeWidgetItem * QTreeWidget::currentItem ( ) const

Returns the current item in the tree widget.

See also
setCurrentItem(), currentItemChanged()
void QTreeWidget::currentItemChanged ( QTreeWidgetItem current,
QTreeWidgetItem previous 
)
signal

This signal is emitted when the current item changes. The current item is specified by current which replaces the previous current item.

See also
setCurrentItem()
void QTreeWidget::dropEvent ( QDropEvent event)
overrideprotectedvirtual

Reimplemented from QAbstractItemView::dropEvent()

bool QTreeWidget::dropMimeData ( QTreeWidgetItem parent,
int  index,
const QMimeData data,
Qt::DropAction  action 
)
protectedvirtual

Handles the data supplied by a drag and drop operation that ended with the given action in the index in the given parent item. The default implementation returns true if the drop was successfully handled by decoding the mime data and inserting it into the model, otherwise it returns false.

See also
supportedDropActions()
void QTreeWidget::editItem ( QTreeWidgetItem item,
int  column = 0 
)

Starts editing the item in the given column, if it is editable.

bool QTreeWidget::event ( QEvent event)
overrideprotected

Reimplemented from QAbstractItemView::event()

void QTreeWidget::expandItem ( const QTreeWidgetItem item)
slot

Expands the given item. This causes the tree containing the child items to be expanded.

See also
collapseItem(), currentItem(), itemAt(), topLevelItem(), itemExpanded()
QList< QTreeWidgetItem * > QTreeWidget::findItems ( const QString text,
Qt::MatchFlags  flags,
int  column = 0 
) const

Returns a list of items which match the given text, using the given flags, in the given column.

QTreeWidgetItem * QTreeWidget::headerItem ( ) const

Returns the item used for the tree widget's header.

See also
setHeaderItem()
QModelIndex QTreeWidget::indexFromItem ( QTreeWidgetItem item,
int  column = 0 
) const
protected

Returns the QModelIndex associated with the given item in the given column.

See also
itemFromIndex(), topLevelItem()
int QTreeWidget::indexOfTopLevelItem ( QTreeWidgetItem item) const

Returns the index of the given top level item or -1 if the item can not be found.

See also
sortItems(), topLevelItemCount()
void QTreeWidget::insertTopLevelItem ( int  index,
QTreeWidgetItem item 
)

Inserts the item at index in the top level in the view. If the item has already been inserted it will not be added again.

See also
addTopLevelItem(), columnCount()
void QTreeWidget::insertTopLevelItems ( int  index,
const QList< QTreeWidgetItem * > &  items 
)

Inserts the list of items at index in the top level in the view. If the item has already been inserted it will not be added again.

See also
addTopLevelItems()
QTreeWidgetItem * QTreeWidget::invisibleRootItem ( ) const

Returns the invisible root item. The invisible root item is the parent for all visible top level items.

Note
Calling index() on this root item is not valid.
bool QTreeWidget::isFirstItemColumnSpanned ( const QTreeWidgetItem item) const

Returns true if the given item is set to show only one section over all columns, otherwise returns false.

See also
setFirstItemColumnSpanned()
bool QTreeWidget::isItemExpanded ( const QTreeWidgetItem item) const
deprecated
Deprecated:
Use QTreeWidgetItem::isExpanded() instead.

Returns true if the given item is open, otherwise returns false.

See also
itemExpanded()
bool QTreeWidget::isItemHidden ( const QTreeWidgetItem item) const
deprecated
Deprecated:
Use QTreeWidgetItem::isHidden() instead.

Returns true if the item is explicitly hidden, otherwise returns false.

bool QTreeWidget::isItemSelected ( const QTreeWidgetItem item) const
deprecated
Deprecated:
Use QTreeWidgetItem::isSelected() instead.

Returns true if the item is selected, otherwise returns false.

See also
itemSelectionChanged()
QTreeWidgetItem * QTreeWidget::itemAbove ( const QTreeWidgetItem item) const

Returns the item above the given item.

void QTreeWidget::itemActivated ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the user activates an item by clicking the mouse or pressing the enter key. The given item indicates which item was clicked or a nullptr if there is no valid item. The column indicates the column number of the item which was clicked or -1 if no item was clicked.

QTreeWidgetItem * QTreeWidget::itemAt ( const QPoint p) const

Returns a pointer to the item at the coordinates p. The coordinates are relative to the tree widget's viewport().

See also
visualItemRect()
QTreeWidgetItem * QTreeWidget::itemAt ( int  x,
int  y 
) const
inline

Returns a pointer to the item at the coordinates (x, y). The coordinates are relative to the tree widget's viewport().

QTreeWidgetItem * QTreeWidget::itemBelow ( const QTreeWidgetItem item) const

Returns the item displayed below the given item.

void QTreeWidget::itemChanged ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the contents of the column in the specified item changes.

void QTreeWidget::itemClicked ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the user clicks inside the widget. The specified item is the item that was clicked. The column is the item's column that was clicked. If no item was clicked, no signal will be emitted.

void QTreeWidget::itemCollapsed ( QTreeWidgetItem item)
signal

This signal is emitted when the specified item is collapsed so that none of its children are displayed.

See also
QTreeWidgetItem::isExpanded(), itemExpanded(), collapseItem()
void QTreeWidget::itemDoubleClicked ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the user double clicks inside the widget. The given item is the item which was clicked or a nullptr if no item was clicked. The column is the item's column that was clicked.

void QTreeWidget::itemEntered ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the mouse cursor enters an item over the specified column. QTreeWidget mouse tracking needs to be enabled for this feature to work.

void QTreeWidget::itemExpanded ( QTreeWidgetItem item)
signal

This signal is emitted when the specified item is expanded so all of its children are displayed.

See also
setItemExpanded(), QTreeWidgetItem::isExpanded(), itemCollapsed(), expandItem()
QTreeWidgetItem * QTreeWidget::itemFromIndex ( const QModelIndex index) const
protected

Returns a pointer to the QTreeWidgetItem associated with the given index.

See also
indexFromItem()
void QTreeWidget::itemPressed ( QTreeWidgetItem item,
int  column 
)
signal

This signal is emitted when the user presses a mouse button inside the widget. The specified item is the item that was clicked or a nullptr if no item was clicked. The column is the item's column that was clicked or -1 if no item was clicked.

void QTreeWidget::itemSelectionChanged ( )
signal

This signal is emitted when the selection changes in the tree widget. The current selection can be found with selectedItems().

QWidget * QTreeWidget::itemWidget ( QTreeWidgetItem item,
int  column 
) const

Returns the widget displayed in the location specified by item and the given column. The tree takes ownership of the widget.

See also
setItemWidget()
QMimeData * QTreeWidget::mimeData ( const QList< QTreeWidgetItem * > &  items) const
protectedvirtual

Returns an object that contains a serialized description of the specified items. The format used to describe the items is obtained from the mimeTypes() method.

If the list of items is empty then a nullptr is returned.

QStringList QTreeWidget::mimeTypes ( ) const
protectedvirtual

Returns a list of MIME types that can be used to describe a list of tree widget items.

See also
mimeData()
void QTreeWidget::openPersistentEditor ( QTreeWidgetItem item,
int  column = 0 
)

Opens a persistent editor for the item in the given column.

See also
closePersistentEditor()
void QTreeWidget::removeItemWidget ( QTreeWidgetItem item,
int  column 
)
inline

Removes the widget set in the given item in the given column.

void QTreeWidget::scrollToItem ( const QTreeWidgetItem item,
QAbstractItemView::ScrollHint  hint = EnsureVisible 
)
slot

Ensures that the item is visible, scrolling the view if necessary using the specified hint.

See also
currentItem(), itemAt(), topLevelItem()
QList< QTreeWidgetItem * > QTreeWidget::selectedItems ( ) const

Returns a list of all selected non-hidden items.

See also
itemSelectionChanged()
void QTreeWidget::setColumnCount ( int  columns)

Sets the value of the property to columns.

void QTreeWidget::setCurrentItem ( QTreeWidgetItem item)

Sets the current item in the tree widget. Unless the selection mode is NoSelection, the item is also selected.

See also
currentItem(), currentItemChanged()
void QTreeWidget::setCurrentItem ( QTreeWidgetItem item,
int  column 
)

Sets the current item to the given item in the specified column.

See also
currentItem()
void QTreeWidget::setCurrentItem ( QTreeWidgetItem item,
int  column,
QItemSelectionModel::SelectionFlags  command 
)

Sets the current item to the given item in the specified column, using the given command.

See also
currentItem()
void QTreeWidget::setFirstItemColumnSpanned ( const QTreeWidgetItem item,
bool  span 
)

Sets the given item to only show one section for all columns if span is true, otherwise the item will show one section per column.

See also
isFirstItemColumnSpanned()
void QTreeWidget::setHeaderItem ( QTreeWidgetItem item)

Sets the header item for the tree widget. The label for each column in the header is supplied by the corresponding label in the item. The tree widget takes ownership of the item.

See also
headerItem(), setHeaderLabels()
void QTreeWidget::setHeaderLabel ( const QString label)
inline

Equivalent to calling setHeaderLabels(QStringList(label)).

void QTreeWidget::setHeaderLabels ( const QStringList labels)

Adds a column in the header for each item in the labels list and sets the label for each column. This method will not remove existing columns.

See also
setHeaderItem(), setHeaderLabel()
void QTreeWidget::setItemExpanded ( const QTreeWidgetItem item,
bool  expand 
)
deprecated
Deprecated:
Use QTreeWidgetItem::setExpanded() instead.

Sets the item referred to by item to either closed or opened, depending on the value of expand.

See also
expandItem(), collapseItem(), itemExpanded()
void QTreeWidget::setItemHidden ( const QTreeWidgetItem item,
bool  hide 
)
deprecated
Deprecated:
Use QTreeWidgetItem::setHidden() instead.

Hides the given item if hide is true, otherwise shows the item.

See also
isItemHidden(), itemChanged()
void QTreeWidget::setItemSelected ( const QTreeWidgetItem item,
bool  select 
)
deprecated
Deprecated:
Use QTreeWidgetItem::setSelected() instead.

If select is true the given item is selected, otherwise it is deselected.

See also
isItemSelected(), itemSelectionChanged()
void QTreeWidget::setItemWidget ( QTreeWidgetItem item,
int  column,
QWidget widget 
)

Sets the given widget to be displayed in the cell specified by the given item and column. The given widget's autoFillBackground property must be set to true, otherwise the widget's background will be transparent, showing both the model data and the tree widget item. This method should only be used to display static content in the place of a tree widget item. If you want to display custom dynamic content or implement a custom editor widget, use QTreeView and subclass QItemDelegate instead.

This method can not be called before the item hierarchy has been set up. The QTreeWidgetItem which contains the QTreeWidgets must be added to the view before calling this method. The QTreeWidget takes ownership of the QWidget.

See also
itemWidget(), Delegate Classes
void QTreeWidget::setSelectionModel ( QItemSelectionModel selectionModel)
overridevirtual

Reimplemented from QTreeView::setSelectionModel()

int QTreeWidget::sortColumn ( ) const

Returns the column used to sort the contents of the widget.

See also
sortItems()
void QTreeWidget::sortItems ( int  column,
Qt::SortOrder  order 
)

Sorts the items in the widget in the specified order by the values in the given column.

See also
sortColumn()
Qt::DropActions QTreeWidget::supportedDropActions ( ) const
protectedvirtual

Returns the drop actions supported by this view.

See also
Qt::DropActions
QTreeWidgetItem * QTreeWidget::takeTopLevelItem ( int  index)

Removes the top level item at the given index in the tree and returns a pointer to the QTreeWidgetItem, otherwise returns a nullptr.

See also
insertTopLevelItem(), topLevelItem(), topLevelItemCount()
QTreeWidgetItem * QTreeWidget::topLevelItem ( int  index) const

Returns the top level item at the given index or a nullptr if the item does not exist.

See also
topLevelItemCount(), insertTopLevelItem()
int QTreeWidget::topLevelItemCount ( ) const

Returns the value of the property.

QRect QTreeWidget::visualItemRect ( const QTreeWidgetItem item) const

Returns the rectangle on the viewport occupied by the item at item.

See also
itemAt()

Property Documentation

QTreeWidget::columnCount

This property holds the number of columns displayed in the tree widget. By default this property has a value of 1.

PropertiesClass Methods
read columnCount
write setColumnCount
QTreeWidget::topLevelItemCount

This property holds the number of top level items. By default this property has a value of 0.

See also
columnCount(), currentItem()
PropertiesClass Methods
read topLevelItemCount