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
QSidebar Class Reference

#include <qsidebar_p.h>

+ Inheritance diagram for QSidebar:
+ Collaboration diagram for QSidebar:

Signals

void goToUrl (const QUrl &url)
 
- Signals inherited from QListView
void indexesMoved (const QModelIndexList &indexes)
 
- 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)
 

Public Member Functions

 QSidebar (QWidget *parent=nullptr)
 
void setModelAndUrls (QFileSystemModel *model, const QList< QUrl > &newUrls)
 
 ~QSidebar ()
 
QSize sizeHint () const override
 
void setUrls (const QList< QUrl > &list)
 
void addUrls (const QList< QUrl > &list, int row)
 
QList< QUrlurls () const
 
void selectUrl (const QUrl &url)
 
- Public Member Functions inherited from QListView
 QListView (QWidget *parent=nullptr)
 Creates a new QListView with the given parent to view a model.
 
 ~QListView ()
 Destroys the view.
 
void setMovement (Movement movement)
 
Movement movement () const
 
void setFlow (Flow flow)
 
Flow flow () const
 
void setWrapping (bool enable)
 
bool isWrapping () const
 
void setResizeMode (ResizeMode mode)
 
ResizeMode resizeMode () const
 
void setLayoutMode (LayoutMode mode)
 
LayoutMode layoutMode () const
 
void setSpacing (int space)
 
int spacing () const
 
void setBatchSize (int batchSize)
 
int batchSize () const
 
void setGridSize (const QSize &size)
 
QSize gridSize () const
 
void setViewMode (ViewMode mode)
 
ViewMode viewMode () const
 
void clearPropertyFlags ()
 Clears the QListView-specific property flags.
 
bool isRowHidden (int row) const
 Returns true if the row is hidden; otherwise returns false.
 
void setRowHidden (int row, bool hide)
 If hide is true, the given row will be hidden; otherwise the row will be shown.
 
void setModelColumn (int column)
 
int modelColumn () const
 
void setUniformItemSizes (bool enable)
 
bool uniformItemSizes () const
 
void setWordWrap (bool on)
 
bool wordWrap () const
 
void setSelectionRectVisible (bool show)
 
bool isSelectionRectVisible () const
 
void setItemAlignment (Qt::Alignment alignment)
 
Qt::Alignment itemAlignment () const
 
QRect visualRect (const QModelIndex &index) const override
 \reimp
 
void scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override
 \reimp
 
QModelIndex indexAt (const QPoint &p) const override
 \reimp
 
void doItemsLayout () override
 
void reset () override
 
void setRootIndex (const QModelIndex &index) 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.
 
virtual void setModel (QAbstractItemModel *model)
 Sets the model for the view to present.
 
QAbstractItemModelmodel () const
 Returns the model that this view is presenting.
 
virtual void setSelectionModel (QItemSelectionModel *selectionModel)
 Sets the current selection model to the given selectionModel.
 
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
 
virtual void keyboardSearch (const QString &search)
 Moves to and selects the item best matching the string search.
 
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.
 
virtual int sizeHintForColumn (int column) const
 Returns the width size hint for the specified column 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

bool event (QEvent *e) override
 \reimp
 
void focusInEvent (QFocusEvent *event) override
 \reimp Don't automatically select something
 
- Protected Member Functions inherited from QListView
 QListView (QListViewPrivate &, QWidget *parent=nullptr)
 
bool event (QEvent *e) override
 \reimp
 
void scrollContentsBy (int dx, int dy) override
 \reimp
 
void resizeContents (int width, int height)
 
QSize contentsSize () const
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) override
 \reimp
 
void rowsInserted (const QModelIndex &parent, int start, int end) override
 \reimp
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override
 \reimp
 
void mouseMoveEvent (QMouseEvent *e) override
 \reimp
 
void mouseReleaseEvent (QMouseEvent *e) override
 \reimp
 
void timerEvent (QTimerEvent *e) override
 \reimp
 
void resizeEvent (QResizeEvent *e) override
 \reimp
 
void initViewItemOption (QStyleOptionViewItem *option) const override
 \reimp
 
void paintEvent (QPaintEvent *e) override
 \reimp
 
int horizontalOffset () const override
 \reimp
 
int verticalOffset () const override
 \reimp
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 \reimp
 
QRect rectForIndex (const QModelIndex &index) const
 Returns the rectangle of the item at position index in the model.
 
void setPositionForIndex (const QPoint &position, const QModelIndex &index)
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override
 \reimp
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 \reimp
 
QModelIndexList selectedIndexes () const override
 \reimp
 
void updateGeometries () override
 \reimp
 
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
 
QSize viewportSizeHint () const override
 
- 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.
 
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 QListView
enum  Movement { Static , Free , Snap }
 \value Static The items cannot be moved by the user. More...
 
enum  Flow { LeftToRight , TopToBottom }
 \value LeftToRight The items are laid out in the view from the left to the right. More...
 
enum  ResizeMode { Fixed , Adjust }
 \value Fixed The items will only be laid out the first time the view is shown. More...
 
enum  LayoutMode { SinglePass , Batched }
 \value SinglePass The items are laid out all at once. More...
 
enum  ViewMode { ListMode , IconMode }
 \value ListMode The items are laid out using TopToBottom flow, with Small size and Static movement \value IconMode The items are laid out using LeftToRight flow, with Large size and Free movement More...
 
- 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 QAbstractItemView
virtual void selectAll ()
 Selects all items in the view.
 
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)
 
- 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 QAbstractItemView
virtual void updateEditorData ()
 
virtual void updateEditorGeometries ()
 
virtual void verticalScrollbarAction (int action)
 
virtual void horizontalScrollbarAction (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 QListView
Movement movement
 whether the items can be moved freely, are snapped to a grid, or cannot be moved at all.
 
Flow flow
 which direction the items layout should flow.
 
bool isWrapping
 whether the items layout should wrap.
 
ResizeMode resizeMode
 whether the items are laid out again when the view is resized.
 
LayoutMode layoutMode
 determines whether the layout of items should happen immediately or be delayed.
 
int spacing
 the space around the items in the layout
 
QSize gridSize
 the size of the layout grid
 
ViewMode viewMode
 the view mode of the QListView.
 
int modelColumn
 the column in the model that is visible
 
bool uniformItemSizes
 whether all items in the listview have the same size
 
int batchSize
 the number of items laid out in each batch if \l layoutMode is set to \l Batched.
 
bool wordWrap
 the item text word-wrapping policy
 
bool selectionRectVisible
 if the selection rectangle should be visible
 
Qt::Alignment itemAlignment
 the alignment of each item in its cell
 
- 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 88 of file qsidebar_p.h.

Constructor & Destructor Documentation

◆ QSidebar()

QSidebar::QSidebar ( QWidget * parent = nullptr)

Definition at line 350 of file qsidebar.cpp.

◆ ~QSidebar()

QSidebar::~QSidebar ( )

Definition at line 376 of file qsidebar.cpp.

Member Function Documentation

◆ addUrls()

void QSidebar::addUrls ( const QList< QUrl > & list,
int row )
inline

Definition at line 103 of file qsidebar_p.h.

References list.

◆ event()

bool QSidebar::event ( QEvent * e)
overrideprotected

\reimp

Definition at line 475 of file qsidebar.cpp.

References QListView::event(), Qt::Key_Delete, and QEvent::KeyRelease.

+ Here is the call graph for this function:

◆ focusInEvent()

void QSidebar::focusInEvent ( QFocusEvent * event)
overrideprotected

\reimp Don't automatically select something

Definition at line 466 of file qsidebar.cpp.

References viewport().

+ Here is the call graph for this function:

◆ goToUrl

void QSidebar::goToUrl ( const QUrl & url)
signal

Referenced by QFileDialogPrivate::createWidgets().

+ Here is the caller graph for this function:

◆ selectUrl()

void QSidebar::selectUrl ( const QUrl & url)

Definition at line 395 of file qsidebar.cpp.

References QItemSelectionModel::clear(), connect(), QItemSelectionModel::currentChanged(), disconnect(), i, QAbstractItemModel::index(), QAbstractItemView::model(), QAbstractItemModel::rowCount(), QItemSelectionModel::Select, QItemSelectionModel::select(), QAbstractItemView::selectionModel(), url, and QUrlModel::UrlRole.

+ Here is the call graph for this function:

◆ setModelAndUrls()

void QSidebar::setModelAndUrls ( QFileSystemModel * model,
const QList< QUrl > & newUrls )

◆ setUrls()

void QSidebar::setUrls ( const QList< QUrl > & list)
inline

Definition at line 102 of file qsidebar_p.h.

References list.

◆ sizeHint()

QSize QSidebar::sizeHint ( ) const
override

Definition at line 388 of file qsidebar.cpp.

References QAbstractItemView::model(), and QAbstractItemView::sizeHintForIndex().

+ Here is the call graph for this function:

◆ urls()

QList< QUrl > QSidebar::urls ( ) const
inline

Definition at line 104 of file qsidebar_p.h.


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