qtreeview.sip 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // qtreeview.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtWidgets Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QTreeView : public QAbstractItemView
  22. {
  23. %TypeHeaderCode
  24. #include <qtreeview.h>
  25. %End
  26. public:
  27. explicit QTreeView(QWidget *parent /TransferThis/ = 0);
  28. virtual ~QTreeView();
  29. virtual void setModel(QAbstractItemModel *model /KeepReference/);
  30. virtual void setRootIndex(const QModelIndex &index);
  31. virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/);
  32. QHeaderView *header() const;
  33. void setHeader(QHeaderView *header /Transfer/);
  34. int indentation() const;
  35. void setIndentation(int i);
  36. bool rootIsDecorated() const;
  37. void setRootIsDecorated(bool show);
  38. bool uniformRowHeights() const;
  39. void setUniformRowHeights(bool uniform);
  40. bool itemsExpandable() const;
  41. void setItemsExpandable(bool enable);
  42. int columnViewportPosition(int column) const;
  43. int columnWidth(int column) const;
  44. int columnAt(int x) const;
  45. bool isColumnHidden(int column) const;
  46. void setColumnHidden(int column, bool hide);
  47. bool isRowHidden(int row, const QModelIndex &parent) const;
  48. void setRowHidden(int row, const QModelIndex &parent, bool hide);
  49. bool isExpanded(const QModelIndex &index) const;
  50. void setExpanded(const QModelIndex &index, bool expand);
  51. virtual void keyboardSearch(const QString &search);
  52. virtual QRect visualRect(const QModelIndex &index) const;
  53. virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible);
  54. virtual QModelIndex indexAt(const QPoint &p) const;
  55. QModelIndex indexAbove(const QModelIndex &index) const;
  56. QModelIndex indexBelow(const QModelIndex &index) const;
  57. virtual void reset();
  58. signals:
  59. void expanded(const QModelIndex &index);
  60. void collapsed(const QModelIndex &index);
  61. public:
  62. virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int> &roles = QList<int>());
  63. public slots:
  64. void hideColumn(int column);
  65. void showColumn(int column);
  66. void expand(const QModelIndex &index);
  67. void expandAll();
  68. void collapse(const QModelIndex &index);
  69. void collapseAll();
  70. void resizeColumnToContents(int column);
  71. virtual void selectAll();
  72. protected slots:
  73. void columnResized(int column, int oldSize, int newSize);
  74. void columnCountChanged(int oldCount, int newCount);
  75. void columnMoved();
  76. void reexpand();
  77. void rowsRemoved(const QModelIndex &parent, int first, int last);
  78. protected:
  79. virtual void scrollContentsBy(int dx, int dy);
  80. virtual void rowsInserted(const QModelIndex &parent, int start, int end);
  81. virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
  82. virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
  83. virtual int horizontalOffset() const;
  84. virtual int verticalOffset() const;
  85. virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
  86. virtual QRegion visualRegionForSelection(const QItemSelection &selection) const;
  87. virtual QModelIndexList selectedIndexes() const;
  88. virtual void changeEvent(QEvent *event);
  89. virtual void paintEvent(QPaintEvent *e);
  90. virtual void timerEvent(QTimerEvent *event);
  91. virtual void mouseReleaseEvent(QMouseEvent *event);
  92. virtual void drawRow(QPainter *painter, const QStyleOptionViewItem &options /NoCopy/, const QModelIndex &index) const;
  93. virtual void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const;
  94. void drawTree(QPainter *painter, const QRegion &region) const;
  95. virtual void mousePressEvent(QMouseEvent *e);
  96. virtual void mouseMoveEvent(QMouseEvent *event);
  97. virtual void mouseDoubleClickEvent(QMouseEvent *e);
  98. virtual void keyPressEvent(QKeyEvent *event);
  99. virtual void updateGeometries();
  100. virtual int sizeHintForColumn(int column) const;
  101. int indexRowSizeHint(const QModelIndex &index) const;
  102. virtual void horizontalScrollbarAction(int action);
  103. virtual bool isIndexHidden(const QModelIndex &index) const;
  104. public:
  105. void setColumnWidth(int column, int width);
  106. void setSortingEnabled(bool enable);
  107. bool isSortingEnabled() const;
  108. void setAnimated(bool enable);
  109. bool isAnimated() const;
  110. void setAllColumnsShowFocus(bool enable);
  111. bool allColumnsShowFocus() const;
  112. void sortByColumn(int column, Qt::SortOrder order);
  113. int autoExpandDelay() const;
  114. void setAutoExpandDelay(int delay);
  115. bool isFirstColumnSpanned(int row, const QModelIndex &parent) const;
  116. void setFirstColumnSpanned(int row, const QModelIndex &parent, bool span);
  117. void setWordWrap(bool on);
  118. bool wordWrap() const;
  119. public slots:
  120. void expandToDepth(int depth);
  121. protected:
  122. virtual void dragMoveEvent(QDragMoveEvent *event);
  123. virtual bool viewportEvent(QEvent *event);
  124. int rowHeight(const QModelIndex &index) const;
  125. virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
  126. virtual void currentChanged(const QModelIndex &current, const QModelIndex &previous);
  127. public:
  128. bool expandsOnDoubleClick() const;
  129. void setExpandsOnDoubleClick(bool enable);
  130. bool isHeaderHidden() const;
  131. void setHeaderHidden(bool hide);
  132. void setTreePosition(int logicalIndex);
  133. int treePosition() const;
  134. protected:
  135. virtual QSize viewportSizeHint() const;
  136. public:
  137. void resetIndentation();
  138. public slots:
  139. void expandRecursively(const QModelIndex &index, int depth = -1);
  140. };