Mix-in Classes¶
Mix-in classes for Qt types.
-
class
objettoqt.mixins.OQObjectMixin(*args, **kwargs)¶ Mix-in class for
QObjecttypes.Observes actions sent from an instance of
objetto.bases.BaseObject.>>> from Qt import QtCore >>> from objettoqt.mixins import OQObjectMixin >>> class MixedQObject(OQObjectMixin, QtCore.QObject): ... pass ...
-
objChanged¶ signal
Emitted when the source
objetto.bases.BaseObjectchanges.- Parameters
obj (objetto.bases.BaseObject or None) – New object (or None).
old_obj (objetto.bases.BaseObject or None) – Old object (or None).
phase (objetto.bases.Phase) – Phase.
-
actionReceived¶ signal
Emitted when an action is received.
- Parameters
action (objetto.objects.Action) – Action.
phase (objetto.bases.Phase) – Phase.
-
OBase¶ read-only class attribute
Minimum objetto object base requirement.
- Type
-
_onDestroyed()¶ virtual method
Called after this has been destroyed.
-
_onObjChanged(obj, old_obj, phase)¶ virtual method
Called when the source
objetto.bases.BaseObjectchanges.This method is called before the
objettoqt.mixins.OQObjectMixin.objChangedsignal gets emitted.- Parameters
obj (objetto.bases.BaseObject or None) – New object (or None).
old_obj (objetto.bases.BaseObject or None) – Old object (or None).
phase (objetto.bases.Phase) – Phase.
-
_onActionReceived(action, phase)¶ virtual method
Called when an action is received.
This method is called before the
objettoqt.mixins.OQObjectMixin.actionReceivedsignal gets emitted.- Parameters
action (objetto.objects.Action) – Action.
phase (objetto.bases.Phase) – Phase.
-
isDestroyed()¶ final method
Get whether this has been destroyed or not.
- Returns
True if destroyed.
- Return type
-
obj()¶ final method
Get the object being observed.
- Returns
Object being observed (or None).
- Return type
-
setObj(obj)¶ final method
Set the object to observe.
- Parameters
obj (objetto.bases.BaseObject or None) – Object to observe (or None).
-
objToken()¶ final method
Get the action observer token.
- Returns
Action observer token.
- Return type
-
-
class
objettoqt.mixins.OQWidgetMixin(*args, **kwargs)¶ Mix-in class for
QWidgettypes.Observes actions sent from an instance of
objetto.bases.BaseObject.- Inherits from:
>>> from Qt import QtCore >>> from objettoqt.mixins import OQWidgetMixin >>> class MixedQAbstractItemModel(OQWidgetMixin, QtWidgets.QWidget): ... pass ...
-
class
objettoqt.mixins.OQAbstractItemModelMixin(*args, **kwargs)¶ Mix-in class for
QAbstractItemModeltypes.Observes actions sent from an instance of
objetto.bases.BaseObject.- Inherits from:
>>> from Qt import QtCore >>> from objettoqt.mixins import OQAbstractItemModelMixin >>> class MixedQAbstractItemModel( ... OQAbstractItemModelMixin, QtCore.QAbstractItemModel ... ): ... pass ...
- Raises
TypeError – Not mixed in with a
QAbstractItemModelclass.
-
QBase¶ read-only class attribute
Minimum Qt base requirement.
- Type
-
class
objettoqt.mixins.OQAbstractItemViewMixin(*args, **kwargs)¶ Mix-in class for
QAbstractItemViewtypes (for lists).Observes actions sent from an instance of
objetto.bases.BaseObject.- Inherits from:
>>> from Qt import QtWidgets >>> from objettoqt.mixins import OQAbstractItemViewMixin >>> class MixedQAbstractItemView( ... OQAbstractItemViewMixin, QtWidgets.QAbstractItemView ... ): ... pass ...
- Raises
TypeError – Not mixed in with a
QAbstractItemViewclass.
-
QBase¶ read-only class attribute
Minimum Qt base requirement.
- Type
-
class
objettoqt.mixins.OQListViewMixin(*args, **kwargs)¶ Mix-in class for
QAbstractItemViewtypes.Observes actions sent from an instance of
objetto.bases.BaseObject.- Inherits from:
>>> from Qt import QtWidgets >>> from objettoqt.mixins import OQListViewMixin >>> class MixedQListView(OQListViewMixin, QtWidgets.QListView): ... pass ... >>> class MixedQTreeListView(OQListViewMixin, QtWidgets.QTreeView): ... pass ...
- Raises
TypeError – Not mixed in with a
QAbstractItemViewclass.
-
setAcceptDrops(accept_drop)¶ Set whether to accept drops.
- Parameters
accept_drop (bool) – True to accept.
-
setDragEnabled(drag_enabled)¶ Set whether to enable drag.
- Parameters
drag_enabled (bool) – True to enable.
-
setSelectionMode(mode)¶ Set selection mode.
- Allowed selection modes are:
QtWidgets.QAbstractItemView.SingleSelectionQtWidgets.QAbstractItemView.ContiguousSelectionQtWidgets.QAbstractItemView.NoSelection
- Parameters
mode (SelectionMode) – Supported selection mode.
- Raises
ValueError – Unsupported selection mode provided.
-
setSelectionBehavior(behavior)¶ Set selection behavior.
- Allowed selection behaviors are:
QtWidgets.QAbstractItemView.SelectRows
- Parameters
behavior (SelectionBehavior) – Selection behavior.
- Raises
ValueError – Unsupported selection behavior provided.
-
setDragDropMode(mode)¶ Set drag and drop mode.
- Allowed drag and drop modes are:
QtWidgets.QAbstractItemView.NoDragDropQtWidgets.QAbstractItemView.DragOnlyQtWidgets.QAbstractItemView.DropOnlyQtWidgets.QAbstractItemView.DragDrop
- Parameters
mode (DragDropMode) – Drag and drop mode.
- Raises
ValueError – Unsupported drag and drop mode provided.
-
setDragDropOverwriteMode(overwrite)¶ Set drag and drop overwrite mode.
- Parameters
overwrite (bool) – Only False is allowed.
- Raises
ValueError – Unsupported drag and drop overwwrite mode provided.
-
setDefaultDropAction(action)¶ Set default drop action.
- Allowed default drop actions are:
QtCore.Qt.DropAction.IgnoreActionQtCore.Qt.DropAction.CopyActionQtCore.Qt.DropAction.MoveActionQtCore.Qt.DropAction.ActionMask
- Parameters
action (DropAction) – Drop action.
-
select(selection, mode, current=None)¶ Select and set current.
- Parameters
selection (QItemSelection or QModelIndex) – Selection.
mode (SelectionFlag) – Mode.
current (QModelIndex or None) – Current (None will clear current).
-
deleteSelected()¶ slot
Delete currently selected.
-
clearCurrent()¶ slot
Clear current.
-
clearSelection()¶ slot
Clear selection and current.