Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QFileDialogTreeView Class Reference

#include <qfiledialog_p.h>

+ Inheritance diagram for QFileDialogTreeView:
+ Collaboration diagram for QFileDialogTreeView:

Public Member Functions

 QFileDialogTreeView (QWidget *parent)
 
void setFileDialogPrivate (QFileDialogPrivate *d_pointer)
 
QSize sizeHint () const override
 
- Public Member Functions inherited from QTreeView
 QTreeView (QWidget *parent=nullptr)
 Constructs a tree view with a parent to represent a model's data.
 
 ~QTreeView ()
 Destroys the tree view.
 
void setModel (QAbstractItemModel *model) override
 \reimp
 
void setRootIndex (const QModelIndex &index) override
 \reimp
 
void setSelectionModel (QItemSelectionModel *selectionModel) override
 \reimp
 
QHeaderViewheader () const
 Returns the header for the tree view.
 
void setHeader (QHeaderView *header)
 Sets the header for the tree view, to the given header.
 
int autoExpandDelay () const
 
void setAutoExpandDelay (int delay)
 
int indentation () const
 
void setIndentation (int i)
 
void resetIndentation ()
 
bool rootIsDecorated () const
 
void setRootIsDecorated (bool show)
 
bool uniformRowHeights () const
 
void setUniformRowHeights (bool uniform)
 
bool itemsExpandable () const
 
void setItemsExpandable (bool enable)
 
bool expandsOnDoubleClick () const
 
void setExpandsOnDoubleClick (bool enable)
 
int columnViewportPosition (int column) const
 Returns the horizontal position of the column in the viewport.
 
int columnWidth (int column) const
 Returns the width of the column.
 
void setColumnWidth (int column, int width)
 
int columnAt (int x) const
 Returns the column in the tree view whose header covers the x coordinate given.
 
bool isColumnHidden (int column) const
 Returns true if the column is hidden; otherwise returns false.
 
void setColumnHidden (int column, bool hide)
 If hide is true the column is hidden, otherwise the column is shown.
 
bool isHeaderHidden () const
 
void setHeaderHidden (bool hide)
 
bool isRowHidden (int row, const QModelIndex &parent) const
 Returns true if the item in the given row of the parent is hidden; otherwise returns false.
 
void setRowHidden (int row, const QModelIndex &parent, bool hide)
 If hide is true the row with the given parent is hidden, otherwise the row is shown.
 
bool isFirstColumnSpanned (int row, const QModelIndex &parent) const
 
void setFirstColumnSpanned (int row, const QModelIndex &parent, bool span)
 
bool isExpanded (const QModelIndex &index) const
 Returns true if the model item index is expanded; otherwise returns false.
 
void setExpanded (const QModelIndex &index, bool expand)
 Sets the item referred to by index to either collapse or expanded, depending on the value of expanded.
 
void setSortingEnabled (bool enable)
 
bool isSortingEnabled () const
 
void setAnimated (bool enable)
 
bool isAnimated () const
 
void setAllColumnsShowFocus (bool enable)
 
bool allColumnsShowFocus () const
 
void setWordWrap (bool on)
 
bool wordWrap () const
 
void setTreePosition (int logicalIndex)
 
int treePosition () const
 
void keyboardSearch (const QString &search) override
 \reimp
 
QRect visualRect (const QModelIndex &index) const override
 Returns the rectangle on the viewport occupied by the item at index.
 
void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override
 Scroll the contents of the tree view until the given model item index is visible.
 
QModelIndex indexAt (const QPoint &p) const override
 \reimp
 
QModelIndex indexAbove (const QModelIndex &index) const
 Returns the model index of the item above index.
 
QModelIndex indexBelow (const QModelIndex &index) const
 Returns the model index of the item below index.
 
void doItemsLayout () override
 
void reset () override
 \reimp
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) override
 \reimp
 
void selectAll () override
 \reimp
 
- Public Member Functions inherited from QAbstractItemView
 QAbstractItemView (QWidget *parent=nullptr)
 Constructs an abstract item view with the given parent.
 
 ~QAbstractItemView ()
 Destroys the view.
 
QAbstractItemModelmodel () const
 Returns the model that this view is presenting.
 
QItemSelectionModelselectionModel () const
 Returns the current selection model.
 
void setItemDelegate (QAbstractItemDelegate *delegate)
 Sets the item delegate for this view and its model to delegate.
 
QAbstractItemDelegateitemDelegate () const
 Returns the item delegate used by this view and model.
 
void setSelectionMode (QAbstractItemView::SelectionMode mode)
 
QAbstractItemView::SelectionMode selectionMode () const
 
void setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior)
 
QAbstractItemView::SelectionBehavior selectionBehavior () const
 
QModelIndex currentIndex () const
 Returns the model index of the current item.
 
QModelIndex rootIndex () const
 Returns the model index of the model's root item.
 
void setEditTriggers (EditTriggers triggers)
 
EditTriggers editTriggers () const
 
void setVerticalScrollMode (ScrollMode mode)
 
ScrollMode verticalScrollMode () const
 
void resetVerticalScrollMode ()
 
void setHorizontalScrollMode (ScrollMode mode)
 
ScrollMode horizontalScrollMode () const
 
void resetHorizontalScrollMode ()
 
void setAutoScroll (bool enable)
 
bool hasAutoScroll () const
 
void setAutoScrollMargin (int margin)
 
int autoScrollMargin () const
 
void setTabKeyNavigation (bool enable)
 
bool tabKeyNavigation () const
 
void setAlternatingRowColors (bool enable)
 
bool alternatingRowColors () const
 
void setIconSize (const QSize &size)
 
QSize iconSize () const
 
void setTextElideMode (Qt::TextElideMode mode)
 
Qt::TextElideMode textElideMode () const
 
QSize sizeHintForIndex (const QModelIndex &index) const
 Returns the size hint for the item with the specified index or an invalid size for invalid indexes.
 
virtual int sizeHintForRow (int row) const
 Returns the height size hint for the specified row or -1 if there is no model.
 
void openPersistentEditor (const QModelIndex &index)
 Opens a persistent editor on the item at the given index.
 
void closePersistentEditor (const QModelIndex &index)
 Closes the persistent editor for the item at the given index.
 
bool isPersistentEditorOpen (const QModelIndex &index) const
 
void setIndexWidget (const QModelIndex &index, QWidget *widget)
 
QWidgetindexWidget (const QModelIndex &index) const
 
void setItemDelegateForRow (int row, QAbstractItemDelegate *delegate)
 
QAbstractItemDelegateitemDelegateForRow (int row) const
 
void setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate)
 
QAbstractItemDelegateitemDelegateForColumn (int column) const
 
virtual QAbstractItemDelegateitemDelegateForIndex (const QModelIndex &index) const
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 \reimp
 

Protected Member Functions

void keyPressEvent (QKeyEvent *e) override
 
- Protected Member Functions inherited from QTreeView
 QTreeView (QTreeViewPrivate &dd, QWidget *parent=nullptr)
 
void scrollContentsBy (int dx, int dy) override
 Scrolls the contents of the tree view by (dx, dy).
 
void rowsInserted (const QModelIndex &parent, int start, int end) override
 Informs the view that the rows from the start row to the end row inclusive have been inserted into the parent model item.
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override
 Informs the view that the rows from the start row to the end row inclusive are about to removed from the given parent model item.
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 Move the cursor in the way described by cursorAction, using the information provided by the button modifiers.
 
int horizontalOffset () const override
 Returns the horizontal offset of the items in the treeview.
 
int verticalOffset () const override
 Returns the vertical offset of the items in the tree view.
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override
 Applies the selection command to the items in or touched by the rectangle, rect.
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 Returns the rectangle from the viewport of the items in the given selection.
 
QModelIndexList selectedIndexes () const override
 \reimp
 
void changeEvent (QEvent *event) override
 \reimp
 
void timerEvent (QTimerEvent *event) override
 \reimp
 
void paintEvent (QPaintEvent *event) override
 \reimp
 
void drawTree (QPainter *painter, const QRegion &region) const
 
virtual void drawRow (QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const
 Draws the row in the tree view that contains the model item index, using the painter given.
 
virtual void drawBranches (QPainter *painter, const QRect &rect, const QModelIndex &index) const
 Draws the branches in the tree view on the same row as the model item index, using the painter given.
 
void mousePressEvent (QMouseEvent *event) override
 \reimp
 
void mouseReleaseEvent (QMouseEvent *event) override
 \reimp
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 \reimp
 
void mouseMoveEvent (QMouseEvent *event) override
 \reimp
 
void keyPressEvent (QKeyEvent *event) override
 \reimp
 
bool viewportEvent (QEvent *event) override
 \reimp
 
void updateGeometries () override
 \reimp
 
QSize viewportSizeHint () const override
 \reimp
 
int sizeHintForColumn (int column) const override
 Returns the size hint for the column's width or -1 if there is no model.
 
int indexRowSizeHint (const QModelIndex &index) const
 Returns the size hint for the row indicated by index.
 
int rowHeight (const QModelIndex &index) const
 
void horizontalScrollbarAction (int action) override
 
bool isIndexHidden (const QModelIndex &index) const override
 \reimp
 
void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override
 \reimp
 
void currentChanged (const QModelIndex &current, const QModelIndex &previous) override
 \reimp
 
- Protected Member Functions inherited from QAbstractItemView
 QAbstractItemView (QAbstractItemViewPrivate &, QWidget *parent=nullptr)
 
virtual bool edit (const QModelIndex &index, EditTrigger trigger, QEvent *event)
 Starts editing the item at index, creating an editor if necessary, and returns true if the view's \l{State} is now EditingState; otherwise returns false.
 
virtual QItemSelectionModel::SelectionFlags selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const
 Returns the SelectionFlags to be used when updating a selection model for the specified index.
 
virtual void initViewItemOption (QStyleOptionViewItem *option) const
 
State state () const
 Returns the item view's state.
 
void setState (State state)
 Sets the item view's state to the given state.
 
void scheduleDelayedItemsLayout ()
 Schedules a layout of the items in the view to be executed when the event processing starts.
 
void executeDelayedItemsLayout ()
 Executes the scheduled layouts without waiting for the event processing to begin.
 
void setDirtyRegion (const QRegion &region)
 
void scrollDirtyRegion (int dx, int dy)
 Prepares the view for scrolling by ({dx},{dy}) pixels by moving the dirty regions in the opposite direction.
 
QPoint dirtyRegionOffset () const
 Returns the offset of the dirty regions in the view.
 
void startAutoScroll ()
 
void stopAutoScroll ()
 
void doAutoScroll ()
 
bool focusNextPrevChild (bool next) override
 \reimp
 
bool event (QEvent *event) override
 \reimp
 
bool viewportEvent (QEvent *event) override
 This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::ToolTip,or a QEvent::WhatsThis.
 
void mousePressEvent (QMouseEvent *event) override
 This function is called with the given event when a mouse button is pressed while the cursor is inside the widget.
 
void mouseMoveEvent (QMouseEvent *event) override
 This function is called with the given event when a mouse move event is sent to the widget.
 
void mouseReleaseEvent (QMouseEvent *event) override
 This function is called with the given event when a mouse button is released, after a mouse press event on the widget.
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 This function is called with the given event when a mouse button is double clicked inside the widget.
 
void focusInEvent (QFocusEvent *event) override
 This function is called with the given event when the widget obtains the focus.
 
void focusOutEvent (QFocusEvent *event) override
 This function is called with the given event when the widget loses the focus.
 
void keyPressEvent (QKeyEvent *event) override
 This function is called with the given event when a key event is sent to the widget.
 
void resizeEvent (QResizeEvent *event) override
 This function is called with the given event when a resize event is sent to the widget.
 
void timerEvent (QTimerEvent *event) override
 This function is called with the given event when a timer event is sent to the widget.
 
void inputMethodEvent (QInputMethodEvent *event) override
 \reimp
 
bool eventFilter (QObject *object, QEvent *event) override
 \reimp
 
QSize viewportSizeHint () const override
 

Additional Inherited Members

- Public Types inherited from QAbstractItemView
enum  SelectionMode {
  NoSelection , SingleSelection , MultiSelection , ExtendedSelection ,
  ContiguousSelection
}
 This enum indicates how the view responds to user selections: More...
 
enum  SelectionBehavior { SelectItems , SelectRows , SelectColumns }
 \value SelectItems Selecting single items. More...
 
enum  ScrollHint { EnsureVisible , PositionAtTop , PositionAtBottom , PositionAtCenter }
 \value EnsureVisible Scroll to ensure that the item is visible. More...
 
enum  EditTrigger {
  NoEditTriggers = 0 , CurrentChanged = 1 , DoubleClicked = 2 , SelectedClicked = 4 ,
  EditKeyPressed = 8 , AnyKeyPressed = 16 , AllEditTriggers = 31
}
 This enum describes actions which will initiate item editing. More...
 
enum  ScrollMode { ScrollPerItem , ScrollPerPixel }
 
- Public Slots inherited from QTreeView
void hideColumn (int column)
 Hides the column given.
 
void showColumn (int column)
 Shows the given column in the tree view.
 
void expand (const QModelIndex &index)
 Expands the model item specified by the index.
 
void collapse (const QModelIndex &index)
 Collapses the model item specified by the index.
 
void resizeColumnToContents (int column)
 Resizes the column given to the size of its contents.
 
void sortByColumn (int column, Qt::SortOrder order)
 
void expandAll ()
 
void expandRecursively (const QModelIndex &index, int depth=-1)
 
void collapseAll ()
 
void expandToDepth (int depth)
 
- Public Slots inherited from QAbstractItemView
void edit (const QModelIndex &index)
 Starts editing the item corresponding to the given index if it is editable.
 
void clearSelection ()
 Deselects all selected items.
 
void setCurrentIndex (const QModelIndex &index)
 Sets the current item to be the item at index.
 
void scrollToTop ()
 
void scrollToBottom ()
 
void update (const QModelIndex &index)
 
- Signals inherited from QTreeView
void expanded (const QModelIndex &index)
 This signal is emitted when the item specified by index is expanded.
 
void collapsed (const QModelIndex &index)
 This signal is emitted when the item specified by index is collapsed.
 
- Signals inherited from QAbstractItemView
void pressed (const QModelIndex &index)
 This signal is emitted when a mouse button is pressed.
 
void clicked (const QModelIndex &index)
 This signal is emitted when a mouse button is left-clicked.
 
void doubleClicked (const QModelIndex &index)
 This signal is emitted when a mouse button is double-clicked.
 
void activated (const QModelIndex &index)
 This signal is emitted when the item specified by index is activated by the user.
 
void entered (const QModelIndex &index)
 This signal is emitted when the mouse cursor enters the item specified by index.
 
void viewportEntered ()
 This signal is emitted when the mouse cursor enters the viewport.
 
void iconSizeChanged (const QSize &size)
 
- Protected Types inherited from QAbstractItemView
enum  CursorAction {
  MoveUp , MoveDown , MoveLeft , MoveRight ,
  MoveHome , MoveEnd , MovePageUp , MovePageDown ,
  MoveNext , MovePrevious
}
 This enum describes the different ways to navigate between items,. More...
 
enum  State {
  NoState , DraggingState , DragSelectingState , EditingState ,
  ExpandingState , CollapsingState , AnimatingState
}
 Describes the different states the view can be in. More...
 
- Protected Slots inherited from QTreeView
void columnResized (int column, int oldSize, int newSize)
 This function is called whenever {column}'s size is changed in the header.
 
void columnCountChanged (int oldCount, int newCount)
 Informs the tree view that the number of columns in the tree view has changed from oldCount to newCount.
 
void columnMoved ()
 This slot is called whenever a column has been moved.
 
void reexpand ()
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
void verticalScrollbarValueChanged (int value) override
 
- Protected Slots inherited from QAbstractItemView
virtual void updateEditorData ()
 
virtual void updateEditorGeometries ()
 
virtual void verticalScrollbarAction (int action)
 
virtual void verticalScrollbarValueChanged (int value)
 
virtual void horizontalScrollbarValueChanged (int value)
 
virtual void closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
 Closes the given editor, and releases it.
 
virtual void commitData (QWidget *editor)
 Commit the data in the editor to the model.
 
virtual void editorDestroyed (QObject *editor)
 This function is called when the given editor has been destroyed.
 
- Properties inherited from QTreeView
int autoExpandDelay
 The delay time before items in a tree are opened during a drag and drop operation.
 
int indentation
 indentation of the items in the tree view.
 
bool rootIsDecorated
 whether to show controls for expanding and collapsing top-level items
 
bool uniformRowHeights
 whether all items in the treeview have the same height
 
bool itemsExpandable
 whether the items are expandable by the user.
 
bool sortingEnabled
 whether sorting is enabled
 
bool animated
 whether animations are enabled
 
bool allColumnsShowFocus
 whether items should show keyboard focus using all columns
 
bool wordWrap
 the item text word-wrapping policy
 
bool headerHidden
 whether the header is shown or not.
 
bool expandsOnDoubleClick
 whether the items can be expanded by double-clicking.
 
- Properties inherited from QAbstractItemView
bool autoScroll
 whether autoscrolling in drag move events is enabled
 
int autoScrollMargin
 the size of the area when auto scrolling is triggered
 
EditTriggers editTriggers
 which actions will initiate item editing
 
bool tabKeyNavigation
 whether item navigation with tab and backtab is enabled.
 
bool alternatingRowColors
 whether to draw the background using alternating colors
 
SelectionMode selectionMode
 which selection mode the view operates in
 
SelectionBehavior selectionBehavior
 which selection behavior the view uses
 
QSize iconSize
 the size of items' icons
 
Qt::TextElideMode textElideMode
 the position of the "..." in elided text.
 
ScrollMode verticalScrollMode
 how the view scrolls its contents in the vertical direction
 
ScrollMode horizontalScrollMode
 how the view scrolls its contents in the horizontal direction
 

Detailed Description

Definition at line 306 of file qfiledialog_p.h.

Constructor & Destructor Documentation

◆ QFileDialogTreeView()

QFileDialogTreeView::QFileDialogTreeView ( QWidget * parent)
inline

Definition at line 309 of file qfiledialog_p.h.

Member Function Documentation

◆ keyPressEvent()

void QFileDialogTreeView::keyPressEvent ( QKeyEvent * e)
overrideprotected

Definition at line 4159 of file qfiledialog.cpp.

References QEvent::accept(), QFileDialogPrivate::itemViewKeyboardEvent(), QTreeView::keyPressEvent(), and Qt::NavigationModeKeypadDirectional.

+ Here is the call graph for this function:

◆ setFileDialogPrivate()

◆ sizeHint()

QSize QFileDialogTreeView::sizeHint ( ) const
override

Definition at line 4173 of file qfiledialog.cpp.

References QTreeView::header(), qMax(), sizeHint(), QHeaderView::sizeHint(), QAbstractItemView::sizeHintForRow(), and QSize::width().

Referenced by sizeHint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: