38 #ifndef _pqFlatTreeView_h 39 #define _pqFlatTreeView_h 41 #include "pqWidgetsModule.h" 42 #include <QAbstractScrollArea> 43 #include <QModelIndex> 44 #include <QStyleOptionViewItem> 46 class pqFlatTreeViewItem;
47 class pqFlatTreeViewItemRows;
48 class pqFlatTreeViewInternal;
50 class QAbstractItemModel;
55 class QItemSelectionModel;
112 virtual bool eventFilter(QObject*
object, QEvent* e);
118 QAbstractItemModel*
getModel()
const {
return this->Model; }
119 void setModel(QAbstractItemModel* model);
121 QModelIndex getRootIndex()
const;
122 void setRootIndex(
const QModelIndex& index);
130 void setSelectionModel(QItemSelectionModel* selectionModel);
143 QHeaderView*
getHeader()
const {
return this->HeaderView; }
144 void setHeader(QHeaderView* headerView);
166 void setColumnSizeManaged(
bool managed);
173 int getIconSize()
const;
174 void setIconSize(
int iconSize);
181 bool isIndexHidden(
const QModelIndex& index)
const;
182 void getVisibleRect(
const QModelIndex& index, QRect& area)
const;
183 QModelIndex getIndexVisibleAt(
const QPoint& point)
const;
184 QModelIndex getIndexCellAt(
const QPoint& point)
const;
185 void getSelectionIn(
const QRect& rect, QItemSelection& items)
const;
192 bool isIndexExpanded(
const QModelIndex& index)
const;
193 QModelIndex getNextVisibleIndex(
194 const QModelIndex& index,
const QModelIndex& root = QModelIndex())
const;
195 QModelIndex getRelativeIndex(
const QString&
id,
const QModelIndex& root = QModelIndex())
const;
196 void getRelativeIndexId(
197 const QModelIndex& index, QString&
id,
const QModelIndex& root = QModelIndex())
const;
204 bool startEditing(
const QModelIndex& index);
205 void finishEditing();
206 void cancelEditing();
210 void activated(
const QModelIndex& index);
211 void clicked(
const QModelIndex& index);
216 void setCurrentIndex(
const QModelIndex& index);
218 void expand(
const QModelIndex& index);
219 void collapse(
const QModelIndex& index);
220 void scrollTo(
const QModelIndex& index);
227 void insertRows(
const QModelIndex& parent,
int start,
int end);
228 void startRowRemoval(
const QModelIndex& parent,
int start,
int end);
229 void finishRowRemoval(
const QModelIndex& parent,
int start,
int end);
230 void insertColumns(
const QModelIndex& parent,
int start,
int end);
231 void startColumnRemoval(
const QModelIndex& parent,
int start,
int end);
232 void finishColumnRemoval(
const QModelIndex& parent,
int start,
int end);
233 void updateData(
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
241 virtual void keyPressEvent(QKeyEvent* e);
242 void keyboardSearch(
const QString& search);
249 virtual void mousePressEvent(QMouseEvent* e);
250 virtual void mouseMoveEvent(QMouseEvent* e);
251 virtual void mouseReleaseEvent(QMouseEvent* e);
252 virtual void mouseDoubleClickEvent(QMouseEvent* e);
253 virtual void wheelEvent(QWheelEvent* e);
260 virtual bool event(QEvent* e);
263 int horizontalOffset()
const;
264 int verticalOffset()
const;
266 virtual void resizeEvent(QResizeEvent* e);
267 virtual bool viewportEvent(QEvent* e);
268 virtual void paintEvent(QPaintEvent* e);
269 QStyleOptionViewItem getViewOptions()
const;
276 void handleSectionResized(
int index,
int oldSize,
int newSize);
277 void handleSectionMoved(
int index,
int oldVisual,
int newVisual);
284 void changeCurrent(
const QModelIndex& current,
const QModelIndex& previous);
285 void changeCurrentRow(
const QModelIndex& current,
const QModelIndex& previous);
286 void changeCurrentColumn(
const QModelIndex& current,
const QModelIndex& previous);
287 void changeSelection(
const QItemSelection& selected,
const QItemSelection& deselected);
292 void resetPreferredSizes();
300 void layoutItem(pqFlatTreeViewItem* item,
int& point,
const QFontMetrics& fm);
301 int getDataWidth(
const QModelIndex& index,
const QFontMetrics& fm)
const;
302 int getWidthSum(pqFlatTreeViewItem* item,
int column)
const;
303 bool updateContentsWidth();
304 void updateScrollBars();
305 void addChildItems(pqFlatTreeViewItem* item,
int parentChildCount);
312 bool getIndexRowList(
const QModelIndex& index, pqFlatTreeViewItemRows& rowList)
const;
313 pqFlatTreeViewItem* getItem(
const pqFlatTreeViewItemRows& rowList)
const;
314 pqFlatTreeViewItem* getItem(
const QModelIndex& index)
const;
315 pqFlatTreeViewItem* getItemAt(
int contentsY)
const;
316 pqFlatTreeViewItem* getNextItem(pqFlatTreeViewItem* item)
const;
317 pqFlatTreeViewItem* getNextVisibleItem(pqFlatTreeViewItem* item)
const;
318 pqFlatTreeViewItem* getPreviousVisibleItem(pqFlatTreeViewItem* item)
const;
319 pqFlatTreeViewItem* getLastVisibleItem()
const;
322 void expandItem(pqFlatTreeViewItem* item);
325 const QModelIndex& topLeft,
const QModelIndex& bottomRight, QItemSelection& items)
const;
327 void drawBranches(QPainter& painter, pqFlatTreeViewItem* item,
int halfIndent,
328 const QColor& branchColor,
const QColor& expandColor,
const QStyleOptionViewItem& options);
329 bool drawDecoration(QPainter& painter,
int px,
int py,
const QModelIndex& index,
330 const QStyleOptionViewItem& options,
int itemHeight);
331 void drawData(QPainter& painter,
int px,
int py,
const QModelIndex& index,
332 const QStyleOptionViewItem& options,
int itemHeight,
int itemWidth,
int columnWidth,
335 QPainter& painter,
const QRect& cell,
const QStyleOptionViewItem& options,
bool selected);
338 QAbstractItemModel* Model;
339 QItemSelectionModel* Selection;
342 QHeaderView* HeaderView;
343 pqFlatTreeViewItem* Root;
344 pqFlatTreeViewInternal* Internal;
350 int DoubleTextMargin;
357 static int PipeLength;
QItemSelectionModel * getSelectionModel() const
QHeaderView * getHeader() const
Gets whether or not the column size is managed by the view.
SelectionMode getSelectionMode() const
QAbstractItemModel * getModel() 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.