Qt Signal Slot Base Class
- How Qt Signal And Slots Works
- Qt Signal And Slots
- Qt Signal Slot Thread
- Qt Signal Slot Performance
- Qt Signal Slot Base Classification
QtCore.SIGNAL and QtCore.SLOT macros allow Python to interface with Qt signal and slot delivery mechanisms. This is the old way of using signals and slots. The example below uses the well known clicked signal from a QPushButton. The connect method has a non python-friendly syntax. The QObject class is the base class of all Qt objects. QObject is the heart of the Qt Object Model. The central feature in this model is a very powerful mechanism for seamless object communication called signals and slots. You can connect a signal to a slot with connect and destroy the connection with disconnect.
Home · All Classes · Modules |
The QAbstractItemView class provides the basic functionality foritem view classes. More...
Inherits QAbstractScrollArea.
Inherited by QColumnView, QHeaderView, QListView, QTableView and QTreeView.
Types
- enum CursorAction { MoveUp, MoveDown, MoveLeft, MoveRight, ..., MovePrevious }
- enum DragDropMode { NoDragDrop, DragOnly, DropOnly, DragDrop, InternalMove }
- enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport }
- enum EditTrigger { NoEditTriggers, CurrentChanged, DoubleClicked, SelectedClicked, ..., AllEditTriggers }
- enum ScrollHint { EnsureVisible, PositionAtTop, PositionAtBottom, PositionAtCenter }
- enum SelectionBehavior { SelectItems, SelectRows, SelectColumns }
- enum SelectionMode { NoSelection, SingleSelection, MultiSelection, ExtendedSelection, ContiguousSelection }
- enum State { NoState, DraggingState, DragSelectingState, EditingState, ..., AnimatingState }
Methods
- bool alternatingRowColors (self)
- clearSelection (self)
- closeEditor (self, QWidget editor, QAbstractItemDelegate.EndEditHint hint)
- commitData (self, QWidget editor)
- currentChanged (self, QModelIndex current, QModelIndex previous)
- dataChanged (self, QModelIndex topLeft, QModelIndex bottomRight)
- QPoint dirtyRegionOffset (self)
- bool dragDropOverwriteMode (self)
- dragEnterEvent (self, QDragEnterEvent e)
- dragMoveEvent (self, QDragMoveEvent e)
- DropIndicatorPosition dropIndicatorPosition (self)
- bool edit (self, QModelIndex index, EditTrigger trigger, QEvent event)
- EditTriggers editTriggers (self)
- executeDelayedItemsLayout (self)
- bool focusNextPrevChild (self, bool next)
- bool hasAutoScroll (self)
- horizontalScrollbarAction (self, int action)
- ScrollMode horizontalScrollMode (self)
- QSize iconSize (self)
- QWidget indexWidget (self, QModelIndex index)
- QVariant inputMethodQuery (self, Qt.InputMethodQuery query)
- QAbstractItemDelegate itemDelegate (self)
- QAbstractItemDelegate itemDelegate (self, QModelIndex index)
- QAbstractItemDelegate itemDelegateForColumn (self, int column)
- QAbstractItemDelegate itemDelegateForRow (self, int row)
- keyPressEvent (self, QKeyEvent e)
- mouseDoubleClickEvent (self, QMouseEvent e)
- mousePressEvent (self, QMouseEvent e)
- QModelIndex moveCursor (self, CursorAction cursorAction, Qt.KeyboardModifiers modifiers)
- reset (self)
- QModelIndex rootIndex (self)
- rowsAboutToBeRemoved (self, QModelIndex parent, int start, int end)
- rowsInserted (self, QModelIndex parent, int start, int end)
- scrollDirtyRegion (self, int dx, int dy)
- scrollTo (self, QModelIndex index, ScrollHint hint = QAbstractItemView.EnsureVisible)
- scrollToTop (self)
- list-of-QModelIndex selectedIndexes (self)
- selectionChanged (self, QItemSelection selected, QItemSelection deselected)
- QItemSelectionModel.SelectionFlags selectionCommand (self, QModelIndex index, QEvent event = None)
- QItemSelectionModel selectionModel (self)
- setAutoScroll (self, bool enable)
- setCurrentIndex (self, QModelIndex index)
- setDefaultDropAction (self, Qt.DropAction dropAction)
- setDragDropMode (self, DragDropMode behavior)
- setDragEnabled (self, bool enable)
- setEditTriggers (self, EditTriggers triggers)
- setHorizontalStepsPerItem (self, int steps)
- setIndexWidget (self, QModelIndex index, QWidget widget)
- setItemDelegate (self, QAbstractItemDelegate delegate)
- setItemDelegateForColumn (self, int column, QAbstractItemDelegate delegate)
- setItemDelegateForRow (self, int row, QAbstractItemDelegate delegate)
- setRootIndex (self, QModelIndex index)
- setSelection (self, QRect rect, QItemSelectionModel.SelectionFlags command)
- setSelectionBehavior (self, SelectionBehavior behavior)
- setSelectionModel (self, QItemSelectionModel selectionModel)
- setTabKeyNavigation (self, bool enable)
- setVerticalScrollMode (self, ScrollMode mode)
- bool showDropIndicator (self)
- QSize sizeHintForIndex (self, QModelIndex index)
- startDrag (self, Qt.DropActions supportedActions)
- bool tabKeyNavigation (self)
- timerEvent (self, QTimerEvent e)
- update (self, QModelIndex index)
- updateEditorGeometries (self)
- int verticalOffset (self)
- verticalScrollbarValueChanged (self, int value)
- int verticalStepsPerItem (self)
- bool viewportEvent (self, QEvent e)
- QRegion visualRegionForSelection (self, QItemSelection selection)
Qt Signals
- void clicked (const QModelIndex&)
- void entered (const QModelIndex&)
- void viewportEntered ()
Detailed Description
The QAbstractItemView class provides the basic functionality foritem view classes.
QAbstractItemView class is the base class for every standardview that uses a QAbstractItemModel. QAbstractItemViewis an abstract class and cannot itself be instantiated. It providesa standard interface for interoperating with models through thesignals and slots mechanism, enabling subclasses to be keptup-to-date with changes to their models. This class providesstandard support for keyboard and mouse navigation, viewportscrolling, item editing, and selections. The keyboard navigationimplements this functionality:
Keys | Functionality |
---|---|
Arrow keys | Changes the current item and selects it. |
Ctrl+Arrow keys | Changes the current item but does not select it. |
Shift+Arrow keys | Changes the current item and selects it. The previouslyselected item(s) is not deselected. |
Ctr+Space | Toggles selection of the current item. |
Tab/Backtab | Changes the current item to the next/previous item. |
Home/End | Selects the first/last item in the model. |
Page up/Page down | Scrolls the rows shown up/down by the number of visible rows inthe view. |
Ctrl+A | Selects all items in the model. |
Note that the above table assumes that the selection modeallows the operations. For instance, you cannot select items if theselection mode is QAbstractItemView.NoSelection.
The QAbstractItemView class is one of the Model/View Classes and is part of Qt'smodel/view framework.
The view classes that inherit QAbstractItemView only need toimplement their own view-specific functionality, such as drawingitems, returning the geometry of items, finding items, etc.
QAbstractItemView provides common slots such as edit() and setCurrentIndex().Many protected slots are also provided, including dataChanged(), rowsInserted(), rowsAboutToBeRemoved(),selectionChanged(),and currentChanged().
The root item is returned by rootIndex(), and the currentitem by currentIndex(). To makesure that an item is visible use scrollTo().
Some of QAbstractItemView's functions are concerned withscrolling, for example setHorizontalScrollMode()and setVerticalScrollMode().To set the range of the scroll bars, you can, for example,reimplement the view's resizeEvent()function:
Note that the range is not updated until the widget isshown.
Several other functions are concerned with selection control;for example setSelectionMode(),and setSelectionBehavior().This class provides a default selection model to work with(selectionModel()),but this can be replaced by using setSelectionModel()with an instance of QItemSelectionModel.
For complete control over the display and editing of items youcan specify a delegate with setItemDelegate().
QAbstractItemView provides a lot of protected functions. Someare concerned with editing, for example, edit(), and commitData(), whilst othersare keyboard and mouse event handlers.
Note: If you inherit QAbstractItemView and intend toupdate the contents of the viewport, you should useviewport->update()instead of update() as allpainting operations take place on the viewport.
Type Documentation
QAbstractItemView.CursorAction
Constant | Value | Description |
---|---|---|
QAbstractItemView.MoveUp | 0 | Move to the item above the current item. |
QAbstractItemView.MoveDown | 1 | Move to the item below the current item. |
QAbstractItemView.MoveLeft | 2 | Move to the item left of the currentitem. |
QAbstractItemView.MoveRight | 3 | Move to the item right of the currentitem. |
QAbstractItemView.MoveHome | 4 | Move to the top-left corner item. |
QAbstractItemView.MoveEnd | 5 | Move to the bottom-right corner item. |
QAbstractItemView.MovePageUp | 6 | Move one page up above the current item. |
QAbstractItemView.MovePageDown | 7 | Move one page down below the currentitem. |
QAbstractItemView.MoveNext | 8 | Move to the item after the current item. |
QAbstractItemView.MovePrevious | 9 | Move to the item before the current item. |
See alsomoveCursor().
QAbstractItemView.DragDropMode
Constant | Value | Description |
---|---|---|
QAbstractItemView.NoDragDrop | 0 | Does not support dragging or dropping. |
QAbstractItemView.DragOnly | 1 | The view supports dragging of its ownitems |
QAbstractItemView.DropOnly | 2 | The view accepts drops |
QAbstractItemView.DragDrop | 3 | The view supports both dragging anddropping |
QAbstractItemView.InternalMove | 4 | The view accepts move (not copy)operations only from itself. |
See alsosetDragDropMode()and Usingdrag and drop with item views.
QAbstractItemView.DropIndicatorPosition
Constant | Value | Description |
---|---|---|
QAbstractItemView.OnItem | 0 | The item will be dropped on the index. |
QAbstractItemView.AboveItem | 1 | The item will be dropped above the index. |
QAbstractItemView.BelowItem | 2 | The item will be dropped below the index. |
QAbstractItemView.OnViewport | 3 | The item will be dropped onto a region of theviewport with no items. The way each view handles items droppedonto the viewport depends on the behavior of the underlying modelin use. |
QAbstractItemView.EditTrigger
Constant | Value | Description |
---|---|---|
QAbstractItemView.NoEditTriggers | 0 | No editing possible. |
QAbstractItemView.CurrentChanged | 1 | Editing start whenever current itemchanges. |
QAbstractItemView.DoubleClicked | 2 | Editing starts when an item is doubleclicked. |
QAbstractItemView.SelectedClicked | 4 | Editing starts when clicking on an alreadyselected item. |
QAbstractItemView.EditKeyPressed | 8 | Editing starts when the platform edit key hasbeen pressed over an item. |
QAbstractItemView.AnyKeyPressed | 16 | Editing starts when any key is pressed over anitem. |
QAbstractItemView.AllEditTriggers | 31 | Editing starts for all above actions. |
The EditTriggers type is a typedef for QFlags<EditTrigger>. It stores an ORcombination of EditTrigger values.
QAbstractItemView.ScrollHint
Constant | Value | Description |
---|---|---|
QAbstractItemView.EnsureVisible | 0 | Scroll to ensure that the item isvisible. |
QAbstractItemView.PositionAtTop | 1 | Scroll to position the item at the top of theviewport. |
QAbstractItemView.PositionAtBottom | 2 | Scroll to position the item at the bottom ofthe viewport. |
QAbstractItemView.PositionAtCenter | 3 | Scroll to position the item at the center ofthe viewport. |
QAbstractItemView.ScrollMode
Constant | Value | Description |
---|---|---|
QAbstractItemView.ScrollPerItem | 0 | The view will scroll the contents one item ata time. |
QAbstractItemView.ScrollPerPixel | 1 | The view will scroll the contents one pixel ata time. |
QAbstractItemView.SelectionBehavior
Constant | Value | Description |
---|---|---|
QAbstractItemView.SelectItems | 0 | Selecting single items. |
QAbstractItemView.SelectRows | 1 | Selecting only rows. |
QAbstractItemView.SelectColumns | 2 | Selecting only columns. |
QAbstractItemView.SelectionMode
Constant | Value | Description |
---|---|---|
QAbstractItemView.SingleSelection | 1 | When the user selects an item, anyalready-selected item becomes unselected, and the user cannotunselect the selected item by clicking on it. |
QAbstractItemView.ContiguousSelection | 4 | When the user selects an item in the usualway, the selection is cleared and the new item selected. However,if the user presses the Shift key while clicking on an item, allitems between the current item and the clicked item are selected orunselected, depending on the state of the clicked item. |
QAbstractItemView.ExtendedSelection | 3 | When the user selects an item in the usualway, the selection is cleared and the new item selected. However,if the user presses the Ctrl key when clicking on an item, theclicked item gets toggled and all other items are left untouched.If the user presses the Shift key while clicking on an item, allitems between the current item and the clicked item are selected orunselected, depending on the state of the clicked item. Multipleitems can be selected by dragging the mouse over them. |
QAbstractItemView.MultiSelection | 2 | When the user selects an item in the usualway, the selection status of that item is toggled and the otheritems are left alone. Multiple items can be toggled by dragging themouse over them. |
QAbstractItemView.NoSelection | 0 | Items cannot be selected. |
QAbstractItemView.State
Constant | Value | Description |
---|---|---|
QAbstractItemView.NoState | 0 | The is the default state. |
QAbstractItemView.DraggingState | 1 | The user is dragging items. |
QAbstractItemView.DragSelectingState | 2 | The user is selecting items. |
QAbstractItemView.EditingState | 3 | The user is editing an item in a widgeteditor. |
QAbstractItemView.ExpandingState | 4 | The user is opening a branch of items. |
QAbstractItemView.CollapsingState | 5 | The user is closing a branch of items. |
QAbstractItemView.AnimatingState | 6 | The item view is performing an animation. |
Method Documentation
QAbstractItemView.__init__ (self, QWidgetparent = None)
The parent argument, if not None, causes self to be owned by Qt instead of PyQt.
Constructs an abstract item view with the givenparent.
bool QAbstractItemView.alternatingRowColors (self)
int QAbstractItemView.autoScrollMargin (self)
QAbstractItemView.clearSelection (self)
See alsosetSelection() andselectAll().
QAbstractItemView.closeEditor (self, QWidgeteditor, QAbstractItemDelegate.EndEditHinthint)
This method is also a Qt slot with the C++ signature void closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint).
Closes the given editor, and releases it. The hintis used to specify how the view should respond to the end of theediting operation. For example, the hint may indicate that the nextitem in the view should be opened for editing.
See alsoedit()and commitData().
QAbstractItemView.closePersistentEditor (self, QModelIndexindex)
Closes the persistent editor for the item at the givenindex.
See alsoopenPersistentEditor().
QAbstractItemView.commitData (self, QWidgeteditor)
This method is also a Qt slot with the C++ signature void commitData(QWidget*).
Commit the data in the editor to the model.
See alsocloseEditor().
QAbstractItemView.currentChanged (self, QModelIndexcurrent, QModelIndexprevious)
This method is also a Qt slot with the C++ signature void currentChanged(const QModelIndex&,const QModelIndex&).
This slot is called when a new item becomes the current item.The previous current item is specified by the previousindex, and the new item by the current index.
If you want to know about changes to items see the dataChanged() signal.
QModelIndex QAbstractItemView.currentIndex (self)
Returns the model index of the current item.
See alsosetCurrentIndex().
QAbstractItemView.dataChanged (self, QModelIndextopLeft, QModelIndexbottomRight)
This method is also a Qt slot with the C++ signature void dataChanged(const QModelIndex&,const QModelIndex&).
This slot is called when items are changed in the model. Thechanged items are those from topLeft to bottomRightinclusive. If just one item is changed topLeftbottomRight.
Qt.DropAction QAbstractItemView.defaultDropAction (self)
QPoint QAbstractItemView.dirtyRegionOffset (self)
Returns the offset of the dirty regions in the view.
If you use scrollDirtyRegion()and implement a paintEvent() in asubclass of QAbstractItemView,you should translate the area given by the paint event with theoffset returned from this function.
See alsoscrollDirtyRegion()and setDirtyRegion().
DragDropMode QAbstractItemView.dragDropMode (self)
bool QAbstractItemView.dragDropOverwriteMode (self)
bool QAbstractItemView.dragEnabled (self)
QAbstractItemView.dragEnterEvent (self, QDragEnterEvente)
Reimplemented from QWidget.dragEnterEvent().
This function is called with the given event when a dragand drop operation enters the widget. If the drag is over a validdropping place (e.g. over an item that accepts drops), the event isaccepted; otherwise it is ignored.
See alsodropEvent() and startDrag().
QAbstractItemView.dragLeaveEvent (self, QDragLeaveEvente)
Reimplemented from QWidget.dragLeaveEvent().
This function is called when the item being dragged leaves theview. The event describes the state of the drag and dropoperation.
QAbstractItemView.dragMoveEvent (self, QDragMoveEvente)
Reimplemented from QWidget.dragMoveEvent().
This function is called continuously with the given eventduring a drag and drop operation over the widget. It can cause theview to scroll if, for example, the user drags a selection toview's right or bottom edge. In this case, the event will beaccepted; otherwise it will be ignored.
See alsodropEvent() and startDrag().
QAbstractItemView.dropEvent (self, QDropEvente)
Reimplemented from QWidget.dropEvent().
This function is called with the given event when a dropevent occurs over the widget. If the model accepts the evenposition the drop event is accepted; otherwise it is ignored.
See alsostartDrag().
DropIndicatorPosition QAbstractItemView.dropIndicatorPosition (self)
Returns the position of the drop indicator in relation to theclosest item.
This function was introduced in Qt 4.1.
QAbstractItemView.edit (self, QModelIndexindex)
This method is also a Qt slot with the C++ signature void edit(const QModelIndex&).
Starts editing the item corresponding to the given indexif it is editable.
Note that this function does not change the current index. Sincethe current index defines the next and previous items to edit,users may find that keyboard navigation does not work as expected.To provide consistent navigation behavior, call setCurrentIndex()before this function with the same model index.
See alsoQModelIndex.flags().
bool QAbstractItemView.edit (self, QModelIndexindex, EditTriggertrigger, QEventevent)
Starts editing the item at index, creating an editor ifnecessary, and returns true if the view's State is now EditingState; otherwisereturns false.
The action that caused the editing process is described bytrigger, and the associated event is specified byevent.
Editing can be forced by specifying the trigger to beQAbstractItemView.AllEditTriggers.
See alsocloseEditor().
QAbstractItemView.editorDestroyed (self, QObjecteditor)
This method is also a Qt slot with the C++ signature void editorDestroyed(QObject*).
This function is called when the given editor has beendestroyed.
See alsocloseEditor().
EditTriggers QAbstractItemView.editTriggers (self)
bool QAbstractItemView.event (self, QEventevent)
Reimplemented from QObject.event().
QAbstractItemView.executeDelayedItemsLayout (self)
See alsoscheduleDelayedItemsLayout().
QAbstractItemView.focusInEvent (self, QFocusEvente)
Reimplemented from QWidget.focusInEvent().
This function is called with the given event when thewidget obtains the focus. By default, the event is ignored.
See alsosetFocus()and focusOutEvent().
bool QAbstractItemView.focusNextPrevChild (self, bool next)
Reimplemented from QWidget.focusNextPrevChild().
QAbstractItemView.focusOutEvent (self, QFocusEvente)
Reimplemented from QWidget.focusOutEvent().
This function is called with the given event when thewidget looses the focus. By default, the event is ignored.
See alsoclearFocus() and focusInEvent().
bool QAbstractItemView.hasAutoScroll (self)
int QAbstractItemView.horizontalOffset (self)
See alsoverticalOffset().
QAbstractItemView.horizontalScrollbarAction (self, int action)
QAbstractItemView.horizontalScrollbarValueChanged (self, int value)
ScrollMode QAbstractItemView.horizontalScrollMode (self)
int QAbstractItemView.horizontalStepsPerItem (self)
QSize QAbstractItemView.iconSize (self)
QModelIndex QAbstractItemView.indexAt (self, QPointp)
This method is abstract and should be reimplemented in any sub-class.
Returns the model index of the item at the viewport coordinatespoint.
In the base class this is a pure virtual function.
See alsovisualRect().
QWidget QAbstractItemView.indexWidget (self, QModelIndexindex)
Returns the widget for the item at the given index.
This function was introduced in Qt 4.1.
See alsosetIndexWidget().
QAbstractItemView.inputMethodEvent (self, QInputMethodEventevent)
Reimplemented from QWidget.inputMethodEvent().
QVariant QAbstractItemView.inputMethodQuery (self, Qt.InputMethodQueryquery)
Reimplemented from QWidget.inputMethodQuery().
bool QAbstractItemView.isIndexHidden (self, QModelIndexindex)
This method is abstract and should be reimplemented in any sub-class.
Returns true if the item referred to by the given indexis hidden in the view, otherwise returns false.
Hiding is a view specific feature. For example in TableView acolumn can be marked as hidden or a row in the TreeView.
In the base class this is a pure virtual function.
QAbstractItemDelegate QAbstractItemView.itemDelegate (self)
Returns the item delegate used by this view and model. This iseither one set with setItemDelegate(), orthe default one.
See alsosetItemDelegate().
QAbstractItemDelegate QAbstractItemView.itemDelegate (self, QModelIndexindex)
Returns the item delegate used by this view and model for thegiven index.
QAbstractItemDelegate QAbstractItemView.itemDelegateForColumn (self, int column)
Returns the item delegate used by this view and model for thegiven column. You can call itemDelegate() to get apointer to the current delegate for a given index.
This function was introduced in Qt 4.2.
See alsosetItemDelegateForColumn(),itemDelegateForRow(),and itemDelegate().
QAbstractItemDelegate QAbstractItemView.itemDelegateForRow (self, int row)
Returns the item delegate used by this view and model for thegiven row, or 0 if no delegate has been assigned. You cancall itemDelegate() to get apointer to the current delegate for a given index.
This function was introduced in Qt 4.2.
See alsosetItemDelegateForRow(),itemDelegateForColumn(),and setItemDelegate().
QAbstractItemView.keyboardSearch (self, QString search)
In the default implementation, the search is reset ifsearch is empty, or the time interval since the last searchhas exceeded QApplication.keyboardInputInterval().
QAbstractItemView.keyPressEvent (self, QKeyEvente)
Reimplemented from QWidget.keyPressEvent().
This function is called with the given event when a keyevent is sent to the widget. The default implementation handlesbasic cursor movement, e.g. Up, Down, Left, Right, Home, PageUp,and PageDown; the activated() signal isemitted if the current index is valid and the activation key ispressed (e.g. Enter or Return, depending on the platform). Thisfunction is where editing is initiated by key press, e.g. if F2 ispressed.
See alsoedit(), moveCursor(), keyboardSearch(), andtabKeyNavigation.
QAbstractItemModel QAbstractItemView.model (self)
Returns the model that this view is presenting.
See alsosetModel().
QAbstractItemView.mouseDoubleClickEvent (self, QMouseEvente)
Reimplemented from QWidget.mouseDoubleClickEvent().
This function is called with the given event when a mousebutton is double clicked inside the widget. If the double-click ison a valid item it emits the doubleClicked() signaland calls edit() on theitem.
QAbstractItemView.mouseMoveEvent (self, QMouseEvente)
Reimplemented from QWidget.mouseMoveEvent().
This function is called with the given event when a mousemove event is sent to the widget. If a selection is in progress andnew items are moved over the selection is extended; if a drag is inprogress it is continued.
QAbstractItemView.mousePressEvent (self, QMouseEvente)
Reimplemented from QWidget.mousePressEvent().
This function is called with the given event when a mousebutton is pressed while the cursor is inside the widget. If a validitem is pressed on it is made into the current item. This functionemits the pressed()signal.
QAbstractItemView.mouseReleaseEvent (self, QMouseEvente)
Reimplemented from QWidget.mouseReleaseEvent().
This function is called with the given event when a mousebutton is released, after a mouse press event on the widget. If auser presses the mouse inside your widget and then drags the mouseto another location before releasing the mouse button, your widgetreceives the release event. The function will emit the clicked() signal if an itemwas being pressed.
QModelIndex QAbstractItemView.moveCursor (self, CursorActioncursorAction, Qt.KeyboardModifiersmodifiers)
This method is abstract and should be reimplemented in any sub-class.
Returns a QModelIndex objectpointing to the next object in the view, based on the givencursorAction and keyboard modifiers specified bymodifiers.
In the base class this is a pure virtual function.
QAbstractItemView.openPersistentEditor (self, QModelIndexindex)
Opens a persistent editor on the item at the given index.If no editor exists, the delegate will create a new editor.
See alsoclosePersistentEditor().
QAbstractItemView.reset (self)
QAbstractItemView.resizeEvent (self, QResizeEvente)
Reimplemented from QWidget.resizeEvent().
This function is called with the given event when aresize event is sent to the widget.
See alsoQWidget.resizeEvent().
QModelIndex QAbstractItemView.rootIndex (self)
Returns the model index of the model's root item. The root itemis the parent item to the view's toplevel items. The root can beinvalid.
See alsosetRootIndex().
QAbstractItemView.rowsAboutToBeRemoved (self, QModelIndexparent, int start, int end)
This method is also a Qt slot with the C++ signature void rowsAboutToBeRemoved(const QModelIndex&,int,int).
This slot is called when rows are about to be removed. Thedeleted rows are those under the given parent fromstart to end inclusive.
See alsorowsInserted().
QAbstractItemView.rowsInserted (self, QModelIndexparent, int start, int end)
This method is also a Qt slot with the C++ signature void rowsInserted(const QModelIndex&,int,int).
This slot is called when rows are inserted. The new rows arethose under the given parent from start to endinclusive. The base class implementation calls fetchMore() on themodel to check for more data.
See alsorowsAboutToBeRemoved().
QAbstractItemView.scheduleDelayedItemsLayout (self)
See alsoexecuteDelayedItemsLayout().
QAbstractItemView.scrollDirtyRegion (self, int dx, int dy)
If you implement scrollContentsBy()in a subclass of QAbstractItemView, call this functionbefore you call QWidget.scroll()on the viewport. Alternatively, just call update().
See alsoscrollContentsBy(),dirtyRegionOffset(),and setDirtyRegion().
QAbstractItemView.scrollTo (self, QModelIndexindex, ScrollHinthint = QAbstractItemView.EnsureVisible)
This method is abstract and should be reimplemented in any sub-class.
Scrolls the view if necessary to ensure that the item atindex is visible. The view will try to position the itemaccording to the given hint.
In the base class this is a pure virtual function.
QAbstractItemView.scrollToBottom (self)
See alsoscrollTo() and scrollToTop().
QAbstractItemView.scrollToTop (self)
See alsoscrollTo() and scrollToBottom().
QAbstractItemView.selectAll (self)
See alsosetSelection(), selectedIndexes(), andclearSelection().
list-of-QModelIndex QAbstractItemView.selectedIndexes (self)
See alsoQItemSelectionModel.selectedIndexes().
SelectionBehavior QAbstractItemView.selectionBehavior (self)
QAbstractItemView.selectionChanged (self, QItemSelectionselected, QItemSelectiondeselected)
This method is also a Qt slot with the C++ signature void selectionChanged(const QItemSelection&,const QItemSelection&).
This slot is called when the selection is changed. The previousselection (which may be empty), is specified by deselected,and the new selection by selected.
See alsosetSelection().
QItemSelectionModel.SelectionFlags QAbstractItemView.selectionCommand (self, QModelIndexindex, QEventevent = None)
Returns the SelectionFlags to be used when updating a selectionwith to include the index specified. The event is auser input event, such as a mouse or keyboard event.
Reimplement this function to define your own selectionbehavior.
See alsosetSelection().
SelectionMode QAbstractItemView.selectionMode (self)
QItemSelectionModel QAbstractItemView.selectionModel (self)
Returns the current selection model.
See alsosetSelectionModel()and selectedIndexes().
QAbstractItemView.setAlternatingRowColors (self, bool enable)
QAbstractItemView.setAutoScroll (self, bool enable)
QAbstractItemView.setAutoScrollMargin (self, int margin)
QAbstractItemView.setCurrentIndex (self, QModelIndexindex)
This method is also a Qt slot with the C++ signature void setCurrentIndex(const QModelIndex&).
Sets the current item to be the item at index.
Unless the current selection mode is NoSelection, theitem is also be selected. Note that this function also updates thestarting position for any new selections the user performs.
To set an item as the current item without selecting it,call
selectionModel()->setCurrentIndex(index,QItemSelectionModel.NoUpdate);
See alsocurrentIndex(), currentChanged(), andselectionMode.
QAbstractItemView.setDefaultDropAction (self, Qt.DropActiondropAction)
QAbstractItemView.setDirtyRegion (self, QRegionregion)
Marks the given region as dirty and schedules it to beupdated. You only need to call this function if you areimplementing your own view subclass.
This function was introduced in Qt 4.1.
See alsoscrollDirtyRegion()and dirtyRegionOffset().
QAbstractItemView.setDragDropMode (self, DragDropModebehavior)
QAbstractItemView.setDragDropOverwriteMode (self, bool overwrite)
QAbstractItemView.setDragEnabled (self, bool enable)
QAbstractItemView.setDropIndicatorShown (self, bool enable)
QAbstractItemView.setEditTriggers (self, EditTriggerstriggers)
QAbstractItemView.setHorizontalScrollMode (self, ScrollModemode)
QAbstractItemView.setHorizontalStepsPerItem (self, int steps)
QAbstractItemView.setIconSize (self, QSizesize)
QAbstractItemView.setIndexWidget (self, QModelIndexindex, QWidgetwidget)
The widget argument has it's ownership transferred to Qt.
Sets the given widget on the item at the givenindex, passing the ownership of the widget to theviewport.
If index is invalid (e.g., if you pass the root index),this function will do nothing.
The given widget's autoFillBackground property must be set to true,otherwise the widget's background will be transparent, showing boththe model data and the item at the given index.
If index widget A is replaced with index widget B, index widgetA will be deleted. For example, in the code snippet below, theQLineEdit object will be deleted.
This function should only be used to display static contentwithin the visible area corresponding to an item of data. If youwant to display custom dynamic content or implement a custom editorwidget, subclass QItemDelegateinstead.
This function was introduced in Qt 4.1.
See alsoindexWidget() and DelegateClasses.
QAbstractItemView.setItemDelegate (self, QAbstractItemDelegatedelegate)
Sets the item delegate for this view and its model todelegate. This is useful if you want complete control overthe editing and display of items.
Any existing delegate will be removed, but not deleted. QAbstractItemView does not takeownership of delegate.
Warning: You should not share the same instance of adelegate between views. Doing so can cause incorrect or unintuitiveediting behavior since each view connected to a given delegate mayreceive the closeEditor() signal,and attempt to access, modify or close an editor that has alreadybeen closed.
See alsoitemDelegate().
QAbstractItemView.setItemDelegateForColumn (self, int column, QAbstractItemDelegatedelegate)
Sets the given item delegate used by this view and modelfor the given column. All items on column will bedrawn and managed by delegate instead of using the defaultdelegate (i.e., itemDelegate()).
Any existing column delegate for column will be removed,but not deleted. QAbstractItemView does not takeownership of delegate.
Note: If a delegate has been assigned to both a row and acolumn, the row delegate will take precedence and manage theintersecting cell index.
Warning: You should not share the same instance of adelegate between views. Doing so can cause incorrect or unintuitiveediting behavior since each view connected to a given delegate mayreceive the closeEditor() signal,and attempt to access, modify or close an editor that has alreadybeen closed.
This function was introduced in Qt 4.2.
See alsoitemDelegateForColumn(),setItemDelegateForRow(),and itemDelegate().
QAbstractItemView.setItemDelegateForRow (self, int row, QAbstractItemDelegatedelegate)
Sets the given item delegate used by this view and modelfor the given row. All items on row will be drawn andmanaged by delegate instead of using the default delegate(i.e., itemDelegate()).
Any existing row delegate for row will be removed, butnot deleted. QAbstractItemViewdoes not take ownership of delegate.
Note: If a delegate has been assigned to both a row and acolumn, the row delegate (i.e., this delegate) will take precedenceand manage the intersecting cell index.
Warning: You should not share the same instance of adelegate between views. Doing so can cause incorrect or unintuitiveediting behavior since each view connected to a given delegate mayreceive the closeEditor() signal,and attempt to access, modify or close an editor that has alreadybeen closed.
This function was introduced in Qt 4.2.
See alsoitemDelegateForRow(),setItemDelegateForColumn(),and itemDelegate().
QAbstractItemView.setModel (self, QAbstractItemModelmodel)
Sets the model for the view to present.
This function will create and set a new selection model,replacing any model that was previously set with setSelectionModel().However, the old selection model will not be deleted as it may beshared between several views. We recommend that you delete the oldselection model if it is no longer required. This is done with thefollowing code:
If both the old model and the old selection model do not haveparents, or if their parents are long-lived objects, it may bepreferable to call their deleteLater() functions toexplicitly delete them.
The view does not take ownership of the model unless itis the model's parent object because the model may be sharedbetween many different views.
See alsomodel(), selectionModel(), andsetSelectionModel().
QAbstractItemView.setRootIndex (self, QModelIndexindex)
This method is also a Qt slot with the C++ signature void setRootIndex(const QModelIndex&).
Sets the root item to the item at the given index.
See alsorootIndex().
QAbstractItemView.setSelection (self, QRectrect, QItemSelectionModel.SelectionFlagscommand)
This method is abstract and should be reimplemented in any sub-class.
Applies the selection flags to the items in or touched bythe rectangle, rect.
When implementing your own itemview setSelection should callselectionModel()->select(selection,flags) where selection is either an empty QModelIndex or a QItemSelection that contains all itemsthat are contained in rect.
See alsoselectionCommand()and selectedIndexes().
QAbstractItemView.setSelectionBehavior (self, SelectionBehaviorbehavior)
QAbstractItemView.setSelectionMode (self, SelectionModemode)
QAbstractItemView.setSelectionModel (self, QItemSelectionModelselectionModel)
Sets the current selection model to the givenselectionModel.
Note that, if you call setModel() after thisfunction, the given selectionModel will be replaced by onecreated by the view.
Note: It is up to the application to delete the oldselection model if it is no longer needed; i.e., if it is not beingused by other views. This will happen automatically when its parentobject is deleted. However, if it does not have a parent, or if theparent is a long-lived object, it may be preferable to call itsdeleteLater() function toexplicitly delete it.
See alsoselectionModel(),setModel(), andclearSelection().
QAbstractItemView.setState (self, Statestate)
Sets the item view's state to the given state.
See alsostate().
QAbstractItemView.setTabKeyNavigation (self, bool enable)
QAbstractItemView.setTextElideMode (self, Qt.TextElideModemode)
QAbstractItemView.setVerticalScrollMode (self, ScrollModemode)
QAbstractItemView.setVerticalStepsPerItem (self, int steps)
bool QAbstractItemView.showDropIndicator (self)
int QAbstractItemView.sizeHintForColumn (self, int column)
See alsosizeHintForRow().
QSize QAbstractItemView.sizeHintForIndex (self, QModelIndexindex)
Returns the size hint for the item with the specifiedindex or an invalid size for invalid indexes.
See alsosizeHintForRow() andsizeHintForColumn().
int QAbstractItemView.sizeHintForRow (self, int row)
The returned height is calculated using the size hints of thegiven row's items, i.e. the returned value is the maximumheight among the items. Note that to control the height of a row,you must reimplement the QAbstractItemDelegate.sizeHint()function.
This function is used in views with a vertical header to findthe size hint for a header section based on the contents of thegiven row.
See alsosizeHintForColumn().
QAbstractItemView.startDrag (self, Qt.DropActionssupportedActions)
Starts a drag by calling drag->exec() using the givensupportedActions.
State QAbstractItemView.state (self)
Returns the item view's state.
See alsosetState().
bool QAbstractItemView.tabKeyNavigation (self)
Qt.TextElideMode QAbstractItemView.textElideMode (self)
QAbstractItemView.timerEvent (self, QTimerEvente)
Reimplemented from QObject.timerEvent().
This function is called with the given event when a timerevent is sent to the widget.
See alsoQObject.timerEvent().
QAbstractItemView.update (self)
QAbstractItemView.update (self, QModelIndexindex)
This method is also a Qt slot with the C++ signature void update(const QModelIndex&).
QAbstractItemView.updateEditorData (self)
QAbstractItemView.updateEditorGeometries (self)
QAbstractItemView.updateGeometries (self)
int QAbstractItemView.verticalOffset (self)
See alsohorizontalOffset().
QAbstractItemView.verticalScrollbarAction (self, int action)
QAbstractItemView.verticalScrollbarValueChanged (self, int value)
ScrollMode QAbstractItemView.verticalScrollMode (self)
int QAbstractItemView.verticalStepsPerItem (self)
QStyleOptionViewItem QAbstractItemView.viewOptions (self)
Returns a QStyleOptionViewItem structurepopulated with the view's palette, font, state, alignments etc.
bool QAbstractItemView.viewportEvent (self, QEvente)
Reimplemented from QAbstractScrollArea.viewportEvent().
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. It passes all otherevents on to its base class viewportEvent() handler.
QRect QAbstractItemView.visualRect (self, QModelIndexindex)
This method is abstract and should be reimplemented in any sub-class.
Returns the rectangle on the viewport occupied by the item atindex.
If your item is displayed in several areas then visualRectshould return the primary area that contains index and not thecomplete area that index might encompasses, touch or causedrawing.
In the base class this is a pure virtual function.
See alsoindexAt() and visualRegionForSelection().
QRegion QAbstractItemView.visualRegionForSelection (self, QItemSelectionselection)
This method is abstract and should be reimplemented in any sub-class.
Returns the region from the viewport of the items in the givenselection.
In the base class this is a pure virtual function.
See alsovisualRect() and selectedIndexes().
Qt Signal Documentation
void activated (const QModelIndex&)
See alsoclicked(), doubleClicked(),entered(), andpressed().
void clicked (const QModelIndex&)
See alsoactivated(), doubleClicked(),entered(), andpressed().
void doubleClicked (const QModelIndex&)
See alsoclicked() and activated().
void entered (const QModelIndex&)
See alsoviewportEntered(),activated(),clicked(), doubleClicked(), andpressed().
void pressed (const QModelIndex&)
Use the QApplication.mouseButtons()function to get the state of the mouse buttons.
See alsoactivated(), clicked(), doubleClicked(), andentered().
void viewportEntered ()
See alsoentered().
PyQt 4.11.4 for X11 | Copyright © Riverbank Computing Ltd and The Qt Company 2015 | Qt 4.8.7 |
The QAbstractButton class is the abstract base class of button widgets, providing functionality common to buttons. More...
Header: | #include <QAbstractButton> |
qmake: | QT += widgets |
Inherits: | QWidget |
Inherited By: | QCheckBox, QPushButton, QRadioButton, and QToolButton |
Properties
|
|
Public Functions
QAbstractButton(QWidget *parent = nullptr) | |
virtual | ~QAbstractButton() |
bool | autoExclusive() const |
bool | autoRepeat() const |
int | autoRepeatDelay() const |
int | autoRepeatInterval() const |
QButtonGroup * | group() const |
QIcon | icon() const |
QSize | iconSize() const |
bool | isCheckable() const |
bool | isChecked() const |
bool | isDown() const |
void | setAutoExclusive(bool) |
void | setAutoRepeat(bool) |
void | setAutoRepeatDelay(int) |
void | setAutoRepeatInterval(int) |
void | setCheckable(bool) |
void | setDown(bool) |
void | setIcon(const QIcon &icon) |
void | setShortcut(const QKeySequence &key) |
void | setText(const QString &text) |
QKeySequence | shortcut() const |
QString | text() const |
Public Slots
void | animateClick(int msec = 100) |
void | click() |
void | setChecked(bool) |
void | setIconSize(const QSize &size) |
void | toggle() |
Signals
void | clicked(bool checked = false) |
void | pressed() |
void | released() |
void | toggled(bool checked) |
Protected Functions
virtual void | checkStateSet() |
virtual bool | hitButton(const QPoint &pos) const |
virtual void | nextCheckState() |
Reimplemented Protected Functions
virtual void | changeEvent(QEvent *e) override |
virtual bool | event(QEvent *e) override |
virtual void | focusInEvent(QFocusEvent *e) override |
virtual void | focusOutEvent(QFocusEvent *e) override |
virtual void | keyPressEvent(QKeyEvent *e) override |
virtual void | keyReleaseEvent(QKeyEvent *e) override |
virtual void | mouseMoveEvent(QMouseEvent *e) override |
virtual void | mousePressEvent(QMouseEvent *e) override |
virtual void | mouseReleaseEvent(QMouseEvent *e) override |
virtual void | paintEvent(QPaintEvent *e) override = 0 |
virtual void | timerEvent(QTimerEvent *e) override |
Detailed Description
This class implements an abstract button. Subclasses of this class handle user actions, and specify how the button is drawn.
QAbstractButton provides support for both push buttons and checkable (toggle) buttons. Checkable buttons are implemented in the QRadioButton and QCheckBox classes. Push buttons are implemented in the QPushButton and QToolButton classes; these also provide toggle behavior if required.
Any button can display a label containing text and an icon. setText() sets the text; setIcon() sets the icon. If a button is disabled, its label is changed to give the button a 'disabled' appearance.
If the button is a text button with a string containing an ampersand ('&'), QAbstractButton automatically creates a shortcut key. For example:
The Alt+C shortcut is assigned to the button, i.e., when the user presses Alt+C the button will call animateClick(). See the QShortcut documentation for details. To display an actual ampersand, use '&&'.
You can also set a custom shortcut key using the setShortcut() function. This is useful mostly for buttons that do not have any text, and therefore can't have any automatic shortcut.
All the buttons provided by Qt (QPushButton, QToolButton, QCheckBox, and QRadioButton) can display both text and icons.
A button can be made the default button in a dialog by means of QPushButton::setDefault() and QPushButton::setAutoDefault().
QAbstractButton provides most of the states used for buttons:
- isDown() indicates whether the button is pressed down.
- isChecked() indicates whether the button is checked. Only checkable buttons can be checked and unchecked (see below).
- isEnabled() indicates whether the button can be pressed by the user.
Note: As opposed to other widgets, buttons derived from QAbstractButton accept mouse and context menu events when disabled.
- setAutoRepeat() sets whether the button will auto-repeat if the user holds it down. autoRepeatDelay and autoRepeatInterval define how auto-repetition is done.
- setCheckable() sets whether the button is a toggle button or not.
The difference between isDown() and isChecked() is as follows. When the user clicks a toggle button to check it, the button is first pressed then released into the checked state. When the user clicks it again (to uncheck it), the button moves first to the pressed state, then to the unchecked state (isChecked() and isDown() are both false).
QAbstractButton provides four signals:
- pressed() is emitted when the left mouse button is pressed while the mouse cursor is inside the button.
- released() is emitted when the left mouse button is released.
- clicked() is emitted when the button is first pressed and then released, when the shortcut key is typed, or when click() or animateClick() is called.
- toggled() is emitted when the state of a toggle button changes.
To subclass QAbstractButton, you must reimplement at least paintEvent() to draw the button's outline and its text or pixmap. It is generally advisable to reimplement sizeHint() as well, and sometimes hitButton() (to determine whether a button press is within the button). For buttons with more than two states (like tri-state buttons), you will also have to reimplement checkStateSet() and nextCheckState().
See also QButtonGroup.
Property Documentation
autoExclusive : bool
This property holds whether auto-exclusivity is enabled
If auto-exclusivity is enabled, checkable buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. In an exclusive button group, only one button can be checked at any time; checking another button automatically unchecks the previously checked one.
The property has no effect on buttons that belong to a button group.
autoExclusive is off by default, except for radio buttons.
Access functions:
bool | autoExclusive() const |
void | setAutoExclusive(bool) |
See also QRadioButton.
autoRepeat : bool
This property holds whether autoRepeat is enabled
If autoRepeat is enabled, then the pressed(), released(), and clicked() signals are emitted at regular intervals when the button is down. autoRepeat is off by default. The initial delay and the repetition interval are defined in milliseconds by autoRepeatDelay and autoRepeatInterval.
Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the system and not by this class. The pressed(), released(), and clicked() signals will be emitted like in the normal case.
Access functions:
autoRepeatDelay : int
This property holds the initial delay of auto-repetition
If autoRepeat is enabled, then autoRepeatDelay defines the initial delay in milliseconds before auto-repetition kicks in.
This property was introduced in Qt 4.2.
Access functions:
int | autoRepeatDelay() const |
void | setAutoRepeatDelay(int) |
See also autoRepeat and autoRepeatInterval.
autoRepeatInterval : int
This property holds the interval of auto-repetition
If autoRepeat is enabled, then autoRepeatInterval defines the length of the auto-repetition interval in millisecons.
This property was introduced in Qt 4.2.
Access functions:
int | autoRepeatInterval() const |
void | setAutoRepeatInterval(int) |
See also autoRepeat and autoRepeatDelay.
checkable : bool
This property holds whether the button is checkable
By default, the button is not checkable.
Access functions:
See also checked.
checked : bool
This property holds whether the button is checked
Only checkable buttons can be checked. By default, the button is unchecked.
Access functions:
bool | isChecked() const |
void | setChecked(bool) |
Notifier signal:
See also checkable.
down : bool
This property holds whether the button is pressed down
If this property is true
, the button is pressed down. The signals pressed() and clicked() are not emitted if you set this property to true. The default is false.
Access functions:
bool | isDown() const |
void | setDown(bool) |
icon : QIcon
This property holds the icon shown on the button
The icon's default size is defined by the GUI style, but can be adjusted by setting the iconSize property.
Access functions:
QIcon | icon() const |
void | setIcon(const QIcon &icon) |
iconSize : QSize
This property holds the icon size used for this button.
The default size is defined by the GUI style. This is a maximum size for the icons. Smaller icons will not be scaled up.
Access functions:
QSize | iconSize() const |
void | setIconSize(const QSize &size) |
shortcut : QKeySequence
This property holds the mnemonic associated with the button
Access functions:
QKeySequence | shortcut() const |
void | setShortcut(const QKeySequence &key) |
text : QString
This property holds the text shown on the button
If the button has no text, the text() function will return an empty string.
If the text contains an ampersand character ('&'), a shortcut is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous shortcut will be overwritten or cleared if no shortcut is defined by the text. See the QShortcut documentation for details. To display an actual ampersand, use '&&'.
There is no default text.
Access functions:
QString | text() const |
void | setText(const QString &text) |
Member Function Documentation
QAbstractButton::QAbstractButton(QWidget *parent = nullptr)
Constructs an abstract button with a parent.
[slot]
void QAbstractButton::animateClick(intmsec = 100)
Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).
Calling this function again before the button is released resets the release timer.
All signals associated with a click are emitted as appropriate.
This function does nothing if the button is disabled.
See also click().
[slot]
void QAbstractButton::click()
Performs a click.
All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.
This function does nothing if the button is disabled.
See also animateClick().
[signal]
void QAbstractButton::clicked(boolchecked = false)
This signal is emitted when the button is activated (i.e., pressed down then released while the mouse cursor is inside the button), when the shortcut key is typed, or when click() or animateClick() is called. Notably, this signal is not emitted if you call setDown(), setChecked() or toggle().
If the button is checkable, checked is true if the button is checked, or false if the button is unchecked.
See also pressed(), released(), and toggled().
[signal]
void QAbstractButton::pressed()
This signal is emitted when the button is pressed down.
See also released() and clicked().
[signal]
void QAbstractButton::released()
This signal is emitted when the button is released.
See also pressed(), clicked(), and toggled().
[slot]
void QAbstractButton::toggle()
Toggles the state of a checkable button.
See also checked.
[signal]
void QAbstractButton::toggled(boolchecked)
This signal is emitted whenever a checkable button changes its state. checked is true if the button is checked, or false if the button is unchecked.
This may be the result of a user action, click() slot activation, or because setChecked() is called.
The states of buttons in exclusive button groups are updated before this signal is emitted. This means that slots can act on either the 'off' signal or the 'on' signal emitted by the buttons in the group whose states have changed.
For example, a slot that reacts to signals emitted by newly checked buttons but which ignores signals from buttons that have been unchecked can be implemented using the following pattern:
Button groups can be created using the QButtonGroup class, and updates to the button states monitored with the QButtonGroup::buttonClicked() signal.
Note: Notifier signal for property checked.
See also checked and clicked().
[virtual]
QAbstractButton::~QAbstractButton()
Destroys the button.
[override virtual protected]
void QAbstractButton::changeEvent(QEvent *e)
Reimplements: QWidget::changeEvent(QEvent *event).
[virtual protected]
void QAbstractButton::checkStateSet()
This virtual handler is called when setChecked() is used, unless it is called from within nextCheckState(). It allows subclasses to reset their intermediate button states.
See also nextCheckState().
[override virtual protected]
bool QAbstractButton::event(QEvent *e)
Reimplements: QWidget::event(QEvent *event).
[override virtual protected]
void QAbstractButton::focusInEvent(QFocusEvent *e)
How Qt Signal And Slots Works
Reimplements: QWidget::focusInEvent(QFocusEvent *event).
[override virtual protected]
void QAbstractButton::focusOutEvent(QFocusEvent *e)
Reimplements: QWidget::focusOutEvent(QFocusEvent *event).
QButtonGroup *QAbstractButton::group() const
Returns the group that this button belongs to.
If the button is not a member of any QButtonGroup, this function returns nullptr
.
Qt Signal And Slots
See also QButtonGroup.
[virtual protected]
bool QAbstractButton::hitButton(const QPoint &pos) const
Returns true
if pos is inside the clickable button rectangle; otherwise returns false
.
Qt Signal Slot Thread
By default, the clickable area is the entire widget. Subclasses may reimplement this function to provide support for clickable areas of different shapes and sizes.
[override virtual protected]
void QAbstractButton::keyPressEvent(QKeyEvent *e)
Reimplements: QWidget::keyPressEvent(QKeyEvent *event).
[override virtual protected]
void QAbstractButton::keyReleaseEvent(QKeyEvent *e)
Reimplements: QWidget::keyReleaseEvent(QKeyEvent *event).
[override virtual protected]
void QAbstractButton::mouseMoveEvent(QMouseEvent *e)
Reimplements: QWidget::mouseMoveEvent(QMouseEvent *event).
[override virtual protected]
void QAbstractButton::mousePressEvent(QMouseEvent *e)
Qt Signal Slot Performance
Reimplements: QWidget::mousePressEvent(QMouseEvent *event).
[override virtual protected]
void QAbstractButton::mouseReleaseEvent(QMouseEvent *e)
Reimplements: QWidget::mouseReleaseEvent(QMouseEvent *event).
[virtual protected]
void QAbstractButton::nextCheckState()
This virtual handler is called when a button is clicked. The default implementation calls setChecked(!isChecked()) if the button isCheckable(). It allows subclasses to implement intermediate button states.
See also checkStateSet().
[override pure virtual protected]
void QAbstractButton::paintEvent(QPaintEvent *e)
Reimplements: QWidget::paintEvent(QPaintEvent *event).
Qt Signal Slot Base Classification
[override virtual protected]
void QAbstractButton::timerEvent(QTimerEvent *e)
Reimplements: QObject::timerEvent(QTimerEvent *event).
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.