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
QtPrivate::QCalendarView Class Reference
+ Inheritance diagram for QtPrivate::QCalendarView:
+ Collaboration diagram for QtPrivate::QCalendarView:

Signals

void showDate (QDate date)
 
void changeDate (QDate date, bool changeMonth)
 
void clicked (QDate date)
 
void editingFinished ()
 
- 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

 QCalendarView (QWidget *parent=nullptr)
 
void internalUpdate ()
 
void setReadOnly (bool enable)
 
virtual void keyboardSearch (const QString &) override
 Moves to and selects the item best matching the string search.
 
- Public Member Functions inherited from QTableView
 QTableView (QWidget *parent=nullptr)
 Constructs a table view with a parent to represent the data.
 
 ~QTableView ()
 Destroys the table view.
 
void setModel (QAbstractItemModel *model) override
 \reimp
 
void setRootIndex (const QModelIndex &index) override
 \reimp
 
void setSelectionModel (QItemSelectionModel *selectionModel) override
 \reimp
 
void doItemsLayout () override
 
QHeaderViewhorizontalHeader () const
 Returns the table view's horizontal header.
 
QHeaderViewverticalHeader () const
 Returns the table view's vertical header.
 
void setHorizontalHeader (QHeaderView *header)
 Sets the widget to use for the horizontal header to header.
 
void setVerticalHeader (QHeaderView *header)
 Sets the widget to use for the vertical header to header.
 
int rowViewportPosition (int row) const
 Returns the y-coordinate in contents coordinates of the given row.
 
int rowAt (int y) const
 Returns the row in which the given y-coordinate, y, in contents coordinates is located.
 
void setRowHeight (int row, int height)
 
int rowHeight (int row) const
 Returns the height of the given row.
 
int columnViewportPosition (int column) const
 Returns the x-coordinate in contents coordinates of the given column.
 
int columnAt (int x) const
 Returns the column in which the given x-coordinate, x, in contents coordinates is located.
 
void setColumnWidth (int column, int width)
 
int columnWidth (int column) const
 Returns the width of the given column.
 
bool isRowHidden (int row) const
 Returns true if the given row is hidden; otherwise returns false.
 
void setRowHidden (int row, bool hide)
 If hide is true row will be hidden, otherwise it will be shown.
 
bool isColumnHidden (int column) const
 Returns true if the given column is hidden; otherwise returns false.
 
void setColumnHidden (int column, bool hide)
 If hide is true the given column will be hidden; otherwise it will be shown.
 
void setSortingEnabled (bool enable)
 If enable is true, enables sorting for the table and immediately trigger a call to sortByColumn() with the current sort section and order.
 
bool isSortingEnabled () const
 
bool showGrid () const
 
Qt::PenStyle gridStyle () const
 
void setGridStyle (Qt::PenStyle style)
 
void setWordWrap (bool on)
 
bool wordWrap () 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
 Returns the index position of the model item corresponding to the table item at position pos in contents coordinates.
 
void setSpan (int row, int column, int rowSpan, int columnSpan)
 
int rowSpan (int row, int column) const
 
int columnSpan (int row, int column) const
 
void clearSpans ()
 
- 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.
 
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
 

Public Attributes

bool readOnly
 

Protected Member Functions

QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction and keyboard modifiers specified by modifiers.
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
bool event (QEvent *event) override
 
QDate handleMouseEvent (QMouseEvent *event)
 
- Protected Member Functions inherited from QTableView
 QTableView (QTableViewPrivate &, QWidget *parent)
 
void scrollContentsBy (int dx, int dy) override
 \reimp
 
void initViewItemOption (QStyleOptionViewItem *option) const override
 \reimp
 
void paintEvent (QPaintEvent *e) override
 Paints the table on receipt of the given paint event event.
 
void timerEvent (QTimerEvent *event) override
 \reimp
 
int horizontalOffset () const override
 Returns the horizontal offset of the items in the table view.
 
int verticalOffset () const override
 Returns the vertical offset of the items in the table view.
 
QModelIndex moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
 Moves the cursor in accordance with the given cursorAction, using the information provided by the modifiers.
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override
 Selects the items within the given rect and in accordance with the specified selection flags.
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 \reimp
 
QModelIndexList selectedIndexes () const override
 \reimp
 
void updateGeometries () override
 \reimp
 
QSize viewportSizeHint () const override
 \reimp
 
int sizeHintForRow (int row) const override
 Returns the size hint for the given row's height or -1 if there is no model.
 
int sizeHintForColumn (int column) const override
 Returns the size hint for the given column's width or -1 if there is no model.
 
void verticalScrollbarAction (int action) override
 
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.
 
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 QTableView
void selectRow (int row)
 Selects the given row in the table view if the current SelectionMode and SelectionBehavior allows rows to be selected.
 
void selectColumn (int column)
 Selects the given column in the table view if the current SelectionMode and SelectionBehavior allows columns to be selected.
 
void hideRow (int row)
 Hide the given row.
 
void hideColumn (int column)
 Hide the given column.
 
void showRow (int row)
 Show the given row.
 
void showColumn (int column)
 Show the given column.
 
void resizeRowToContents (int row)
 Resizes the given row based on the size hints of the delegate used to render each item in the row.
 
void resizeRowsToContents ()
 Resizes all rows based on the size hints of the delegate used to render each item in the rows.
 
void resizeColumnToContents (int column)
 Resizes the given column based on the size hints of the delegate used to render each item in the column.
 
void resizeColumnsToContents ()
 Resizes all columns based on the size hints of the delegate used to render each item in the columns.
 
void sortByColumn (int column, Qt::SortOrder order)
 
void setShowGrid (bool show)
 
- Public Slots inherited from QAbstractItemView
virtual void reset ()
 Reset the internal state of the view.
 
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 QTableView
void rowMoved (int row, int oldIndex, int newIndex)
 This slot is called to change the index of the given row in the table view.
 
void columnMoved (int column, int oldIndex, int newIndex)
 This slot is called to change the index of the given column in the table view.
 
void rowResized (int row, int oldHeight, int newHeight)
 This slot is called to change the height of the given row.
 
void columnResized (int column, int oldWidth, int newWidth)
 This slot is called to change the width of the given column.
 
void rowCountChanged (int oldCount, int newCount)
 This slot is called whenever rows are added or deleted.
 
void columnCountChanged (int oldCount, int newCount)
 This slot is called whenever columns are added or deleted.
 
- Protected Slots inherited from QAbstractItemView
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
 This slot is called when items with the given roles are changed in the model.
 
virtual void rowsInserted (const QModelIndex &parent, int start, int end)
 This slot is called when rows are inserted.
 
virtual void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 This slot is called when rows are about to be removed.
 
virtual void updateEditorData ()
 
virtual void updateEditorGeometries ()
 
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 QTableView
bool showGrid
 whether the grid is shown
 
Qt::PenStyle gridStyle
 the pen style used to draw the grid.
 
bool sortingEnabled
 whether sorting is enabled
 
bool wordWrap
 the item text word-wrapping policy
 
- 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 899 of file qcalendarwidget.cpp.

Constructor & Destructor Documentation

◆ QCalendarView()

QtPrivate::QCalendarView::QCalendarView ( QWidget * parent = nullptr)

Definition at line 1304 of file qcalendarwidget.cpp.

References QTableView::horizontalHeader(), Qt::ScrollBarAlwaysOff, QTableView::setShowGrid(), QAbstractItemView::setTabKeyNavigation(), QHeaderView::setVisible(), and QTableView::verticalHeader().

+ Here is the call graph for this function:

Member Function Documentation

◆ changeDate

void QtPrivate::QCalendarView::changeDate ( QDate date,
bool changeMonth )
signal

Referenced by keyPressEvent(), mouseReleaseEvent(), and moveCursor().

+ Here is the caller graph for this function:

◆ clicked

void QtPrivate::QCalendarView::clicked ( QDate date)
signal

Referenced by mouseReleaseEvent().

+ Here is the caller graph for this function:

◆ editingFinished

void QtPrivate::QCalendarView::editingFinished ( )
signal

Referenced by keyPressEvent(), mouseDoubleClickEvent(), and mouseReleaseEvent().

+ Here is the caller graph for this function:

◆ event()

bool QtPrivate::QCalendarView::event ( QEvent * event)
overrideprotected

Definition at line 1423 of file qcalendarwidget.cpp.

References QAbstractItemView::event(), QEvent::FocusIn, and QAbstractItemView::model().

+ Here is the call graph for this function:

◆ handleMouseEvent()

QDate QtPrivate::QCalendarView::handleMouseEvent ( QMouseEvent * event)
protected

Definition at line 1436 of file qcalendarwidget.cpp.

References date, QTableView::indexAt(), QDate::isValid(), QAbstractItemView::model(), and pos.

Referenced by mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

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

◆ internalUpdate()

void QtPrivate::QCalendarView::internalUpdate ( )
inline

Definition at line 905 of file qcalendarwidget.cpp.

References QTableView::updateGeometries().

Referenced by QtPrivate::QCalendarModel::setCalendar(), and QCalendarWidgetPrivate::showMonth().

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

◆ keyboardSearch()

virtual void QtPrivate::QCalendarView::keyboardSearch ( const QString & search)
inlineoverridevirtual

Moves to and selects the item best matching the string search.

If no item is found nothing happens.

In the default implementation, the search is reset if search is empty, or the time interval since the last search has exceeded QApplication::keyboardInputInterval().

Reimplemented from QAbstractItemView.

Definition at line 907 of file qcalendarwidget.cpp.

◆ keyPressEvent()

void QtPrivate::QCalendarView::keyPressEvent ( QKeyEvent * event)
overrideprotected

Definition at line 1375 of file qcalendarwidget.cpp.

References changeDate(), editingFinished(), emit, Qt::Key_Back, Qt::Key_Enter, Qt::Key_Return, Qt::Key_Select, QAbstractItemView::keyPressEvent(), QAbstractItemView::model(), and readOnly.

+ Here is the call graph for this function:

◆ mouseDoubleClickEvent()

void QtPrivate::QCalendarView::mouseDoubleClickEvent ( QMouseEvent * event)
overrideprotected

Definition at line 1452 of file qcalendarwidget.cpp.

References date, editingFinished(), emit, handleMouseEvent(), QAbstractItemView::model(), QAbstractItemView::mouseDoubleClickEvent(), readOnly, and QStyle::SH_ItemView_ActivateItemOnSingleClick.

+ Here is the call graph for this function:

◆ mouseMoveEvent()

void QtPrivate::QCalendarView::mouseMoveEvent ( QMouseEvent * event)
overrideprotected

Definition at line 1498 of file qcalendarwidget.cpp.

References date, handleMouseEvent(), QDate::isValid(), QAbstractItemView::model(), QAbstractItemView::mouseMoveEvent(), QItemSelectionModel::NoUpdate, readOnly, QAbstractItemView::selectionModel(), and QItemSelectionModel::setCurrentIndex().

+ Here is the call graph for this function:

◆ mousePressEvent()

void QtPrivate::QCalendarView::mousePressEvent ( QMouseEvent * event)
overrideprotected

Definition at line 1470 of file qcalendarwidget.cpp.

References date, handleMouseEvent(), QDate::isValid(), Qt::LeftButton, QAbstractItemView::model(), QAbstractItemView::mousePressEvent(), QItemSelectionModel::NoUpdate, readOnly, QAbstractItemView::selectionModel(), and QItemSelectionModel::setCurrentIndex().

+ Here is the call graph for this function:

◆ mouseReleaseEvent()

void QtPrivate::QCalendarView::mouseReleaseEvent ( QMouseEvent * event)
overrideprotected

Definition at line 1523 of file qcalendarwidget.cpp.

References changeDate(), clicked(), date, editingFinished(), emit, handleMouseEvent(), QDate::isValid(), Qt::LeftButton, QAbstractItemView::model(), QAbstractItemView::mouseReleaseEvent(), readOnly, and QStyle::SH_ItemView_ActivateItemOnSingleClick.

+ Here is the call graph for this function:

◆ moveCursor()

QModelIndex QtPrivate::QCalendarView::moveCursor ( CursorAction cursorAction,
Qt::KeyboardModifiers modifiers )
overrideprotectedvirtual

Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction and keyboard modifiers specified by modifiers.

In the base class this is a pure virtual function.

Implements QAbstractItemView.

Definition at line 1317 of file qcalendarwidget.cpp.

References QDate::addDays(), QDate::addMonths(), changeDate(), QAbstractItemView::currentIndex(), QDate::day(), emit, QtPrivate::isRightToLeft(), QAbstractItemView::model(), QTableView::moveCursor(), QAbstractItemView::MoveDown, QAbstractItemView::MoveEnd, QAbstractItemView::MoveHome, QAbstractItemView::MoveLeft, QAbstractItemView::MoveNext, QAbstractItemView::MovePageDown, QAbstractItemView::MovePageUp, QAbstractItemView::MovePrevious, QAbstractItemView::MoveRight, QAbstractItemView::MoveUp, and readOnly.

+ Here is the call graph for this function:

◆ setReadOnly()

void QtPrivate::QCalendarView::setReadOnly ( bool enable)

◆ showDate

void QtPrivate::QCalendarView::showDate ( QDate date)
signal

Member Data Documentation

◆ readOnly

bool QtPrivate::QCalendarView::readOnly

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