10 #ifndef pqFlatTreeView_h 11 #define pqFlatTreeView_h 14 #include <QAbstractScrollArea> 15 #include <QModelIndex> 16 #include <QStyleOptionViewItem> 18 class pqFlatTreeViewItem;
19 class pqFlatTreeViewItemRows;
20 class pqFlatTreeViewInternal;
22 class QAbstractItemModel;
27 class QItemSelectionModel;
83 bool eventFilter(QObject*
object, QEvent* e)
override;
88 QAbstractItemModel* getModel()
const {
return this->Model; }
90 void setModel(QAbstractItemModel* model);
92 QModelIndex getRootIndex()
const;
93 void setRootIndex(
const QModelIndex& index);
99 QItemSelectionModel* getSelectionModel()
const {
return this->Selection; }
101 void setSelectionModel(QItemSelectionModel* selectionModel);
113 QHeaderView* getHeader()
const {
return this->HeaderView; }
115 void setHeader(QHeaderView* headerView);
137 void setColumnSizeManaged(
bool managed);
143 int getIconSize()
const;
145 void setIconSize(
int iconSize);
151 bool isIndexHidden(
const QModelIndex&
index)
const;
153 void getVisibleRect(
const QModelIndex& index, QRect& area)
const;
154 QModelIndex getIndexVisibleAt(
const QPoint&
point)
const;
155 QModelIndex getIndexCellAt(
const QPoint& point)
const;
156 void getSelectionIn(
const QRect& rect, QItemSelection& items)
const;
162 bool isIndexExpanded(
const QModelIndex& index)
const;
164 QModelIndex getNextVisibleIndex(
165 const QModelIndex& index,
const QModelIndex& root = QModelIndex())
const;
166 QModelIndex getRelativeIndex(
const QString&
id,
const QModelIndex& root = QModelIndex())
const;
167 void getRelativeIndexId(
168 const QModelIndex& index, QString&
id,
const QModelIndex& root = QModelIndex())
const;
174 bool startEditing(
const QModelIndex& index);
176 void finishEditing();
177 void cancelEditing();
181 void activated(
const QModelIndex& index);
182 void clicked(
const QModelIndex& index);
187 void setCurrentIndex(
const QModelIndex& index);
189 void expand(
const QModelIndex& index);
190 void collapse(
const QModelIndex& index);
191 void scrollTo(
const QModelIndex& index);
197 void insertRows(
const QModelIndex& parent,
int start,
int end);
199 void startRowRemoval(
const QModelIndex& parent,
int start,
int end);
200 void finishRowRemoval(
const QModelIndex& parent,
int start,
int end);
201 void insertColumns(
const QModelIndex& parent,
int start,
int end);
202 void startColumnRemoval(
const QModelIndex& parent,
int start,
int end);
203 void finishColumnRemoval(
const QModelIndex& parent,
int start,
int end);
204 void updateData(
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
211 void keyPressEvent(QKeyEvent* e)
override;
213 void keyboardSearch(
const QString& search);
219 void mousePressEvent(QMouseEvent* e)
override;
221 void mouseMoveEvent(QMouseEvent* e)
override;
222 void mouseReleaseEvent(QMouseEvent* e)
override;
223 void mouseDoubleClickEvent(QMouseEvent* e)
override;
229 bool event(QEvent* e)
override;
233 int horizontalOffset()
const;
234 int verticalOffset()
const;
236 void resizeEvent(QResizeEvent* e)
override;
237 bool viewportEvent(QEvent* e)
override;
238 void paintEvent(QPaintEvent* e)
override;
239 QStyleOptionViewItem getViewOptions()
const;
245 void handleSectionResized(
int index,
int oldSize,
int newSize);
247 void handleSectionMoved(
int index,
int oldVisual,
int newVisual);
253 void changeCurrent(
const QModelIndex& current,
const QModelIndex&
previous);
255 void changeCurrentRow(
const QModelIndex& current,
const QModelIndex& previous);
256 void changeCurrentColumn(
const QModelIndex& current,
const QModelIndex& previous);
257 void changeSelection(
const QItemSelection& selected,
const QItemSelection& deselected);
262 void resetPreferredSizes();
270 void layoutItem(pqFlatTreeViewItem* item,
int& point,
const QFontMetrics& fm);
271 int getDataWidth(
const QModelIndex& index,
const QFontMetrics& fm)
const;
272 int getWidthSum(pqFlatTreeViewItem* item,
int column)
const;
273 bool updateContentsWidth();
274 void updateScrollBars();
275 void addChildItems(pqFlatTreeViewItem* item,
int parentChildCount);
281 bool getIndexRowList(
const QModelIndex& index, pqFlatTreeViewItemRows& rowList)
const;
283 pqFlatTreeViewItem* getItem(
const pqFlatTreeViewItemRows& rowList)
const;
284 pqFlatTreeViewItem* getItem(
const QModelIndex& index)
const;
285 pqFlatTreeViewItem* getItemAt(
int contentsY)
const;
286 pqFlatTreeViewItem* getNextItem(pqFlatTreeViewItem* item)
const;
287 pqFlatTreeViewItem* getNextVisibleItem(pqFlatTreeViewItem* item)
const;
288 pqFlatTreeViewItem* getPreviousVisibleItem(pqFlatTreeViewItem* item)
const;
289 pqFlatTreeViewItem* getLastVisibleItem()
const;
292 void expandItem(pqFlatTreeViewItem* item);
295 const QModelIndex& topLeft,
const QModelIndex& bottomRight, QItemSelection& items)
const;
297 void drawBranches(QPainter& painter, pqFlatTreeViewItem* item,
int halfIndent,
298 const QColor& branchColor,
const QColor& expandColor,
const QStyleOptionViewItem& options);
299 bool drawDecoration(QPainter& painter,
int px,
int py,
const QModelIndex& index,
300 const QStyleOptionViewItem& options,
int itemHeight);
301 void drawData(QPainter& painter,
int px,
int py,
const QModelIndex& index,
302 const QStyleOptionViewItem& options,
int itemHeight,
int itemWidth,
int columnWidth,
305 QPainter& painter,
const QRect& cell,
const QStyleOptionViewItem& options,
bool selected);
307 QAbstractItemModel* Model;
308 QItemSelectionModel* Selection;
311 QHeaderView* HeaderView;
312 pqFlatTreeViewItem* Root;
313 pqFlatTreeViewInternal* Internal;
319 int DoubleTextMargin;
326 static int PipeLength;
SelectionMode getSelectionMode() const
The pqFlatTreeView class is used to display a flattened tree view of a hierarchical model...
SelectionBehavior getSelectionBehavior() const
bool isColumnSizeManaged() const
Gets whether or not the column size is managed by the view.