Skip to content

KeyCombinationEdit

Qt Base Class: QKeySequenceEdit

Signature: QKeySequenceEdit(self, keySequence: Union[PySide6.QtGui.QKeySequence, PySide6.QtCore.QKeyCombination, PySide6.QtGui.QKeySequence.StandardKey, str, int], parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None QKeySequenceEdit(self, parent: Optional[PySide6.QtWidgets.QWidget] = None) -> None

Base classes

Name Children Inherits
WidgetMixin
prettyqt.widgets.widget
QKeySequenceEdit
PySide6.QtWidgets
QKeySequenceEdit(self, keySequence: Union[PySide6.QtGui.QKeySequence, PySide6.QtCore.QKeyCombination, PySide6.QtGui.QKeySequence.StandardKey, str, int], parent: Optional[PySide6.QtWidgets.QWidget] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473367070640["custom_widgets.KeyCombinationEdit"]
  1473293688240["widgets.WidgetMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473245548480["gui.PaintDeviceMixin"]
  1473290640816["QtWidgets.QKeySequenceEdit"]
  1473290849680["QtWidgets.QWidget"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473300082368["QtGui.QPaintDevice"]
  1473293688240 --> 1473367070640
  1473299815024 --> 1473293688240
  140713234304496 --> 1473299815024
  1473245548480 --> 1473293688240
  140713234304496 --> 1473245548480
  1473290640816 --> 1473367070640
  1473290849680 --> 1473290640816
  1473288842240 --> 1473290849680
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208
  1473300082368 --> 1473290849680
  1473291690208 --> 1473300082368

🛈 DocStrings

Bases: WidgetMixin, QKeySequenceEdit

Source code in prettyqt\custom_widgets\editors\keycombinationedit.py
class KeyCombinationEdit(widgets.WidgetMixin, widgets.QKeySequenceEdit):
    value_changed = core.Signal(core.QKeyCombination)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setMaximumSequenceLength(1)

    def __repr__(self):
        return get_repr(self, self.get_value())

    def _on_value_change(self, val):
        self.value_changed.emit(val[0])

    def set_value(self, value: datatypes.KeyCombinationType):
        if not isinstance(value, gui.QKeySequence):
            value = gui.KeySequence(value)
        if len(value) == 0:
            self.clear()
        else:
            self.setKeySequence(gui.KeySequence(value[0]))

    def get_value(self) -> str:
        seq = self.keySequence()
        return seq[0].toString() if seq.count() > 0 else ""

    def is_valid(self) -> bool:
        return True

⌗ Property table

Qt Property Type Doc
objectName QString
modal bool
windowModality Qt::WindowModality
enabled bool
geometry QRect
frameGeometry QRect
normalGeometry QRect
x int
y int
pos QPoint
frameSize QSize
size QSize
width int
height int
rect QRect
childrenRect QRect
childrenRegion QRegion
sizePolicy QSizePolicy
minimumSize QSize
maximumSize QSize
minimumWidth int
minimumHeight int
maximumWidth int
maximumHeight int
sizeIncrement QSize
baseSize QSize
palette QPalette
font QFont
cursor QCursor
mouseTracking bool
tabletTracking bool
isActiveWindow bool
focusPolicy Qt::FocusPolicy
focus bool
contextMenuPolicy Qt::ContextMenuPolicy
updatesEnabled bool
visible bool
minimized bool
maximized bool
fullScreen bool
sizeHint QSize
minimumSizeHint QSize
acceptDrops bool
windowTitle QString
windowIcon QIcon
windowIconText QString
windowOpacity double
windowModified bool
toolTip QString
toolTipDuration int
statusTip QString
whatsThis QString
accessibleName QString
accessibleDescription QString
layoutDirection Qt::LayoutDirection
autoFillBackground bool
styleSheet QString
locale QLocale
windowFilePath QString
inputMethodHints QFlags
keySequence QKeySequence
clearButtonEnabled bool
maximumSequenceLength qlonglong
finishingKeyCombinations QList