More stupid PyQt enums

This commit is contained in:
Kovid Goyal 2020-12-20 11:10:59 +05:30
parent 168e58d704
commit 1936320bac
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ from functools import partial
from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex, QItemSelectionModel, from PyQt5.Qt import (QObject, QKeySequence, QAbstractItemModel, QModelIndex, QItemSelectionModel,
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame, QAbstractItemView, Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame, QAbstractItemView,
QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout, QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout, QAbstractItemDelegate,
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon, QEvent) QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon, QEvent)
try: try:
from PyQt5 import sip from PyQt5 import sip
@ -610,7 +610,7 @@ class Delegate(QStyledItemDelegate): # {{{
editor.initialize(shortcut, all_shortcuts) editor.initialize(shortcut, all_shortcuts)
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
self.closeEditor.emit(editor, self.NoHint) self.closeEditor.emit(editor, QAbstractItemDelegate.EndEditHint.NoHint)
custom_keys = editor.custom_keys custom_keys = editor.custom_keys
sc = index.data(Qt.ItemDataRole.UserRole).data sc = index.data(Qt.ItemDataRole.UserRole).data
if custom_keys is None: if custom_keys is None:

View File

@ -10,7 +10,7 @@ from functools import partial
from PyQt5.Qt import ( from PyQt5.Qt import (
QAbstractListModel, Qt, QKeySequence, QListView, QVBoxLayout, QLabel, QAbstractItemView, QAbstractListModel, Qt, QKeySequence, QListView, QVBoxLayout, QLabel, QAbstractItemView,
QHBoxLayout, QWidget, QApplication, QStyledItemDelegate, QStyle, QIcon, QHBoxLayout, QWidget, QApplication, QStyledItemDelegate, QStyle, QIcon, QAbstractItemDelegate,
QTextDocument, QRectF, QFrame, QSize, QFont, QKeyEvent, QRadioButton, QPushButton, QToolButton, QEvent QTextDocument, QRectF, QFrame, QSize, QFont, QKeyEvent, QRadioButton, QPushButton, QToolButton, QEvent
) )
@ -187,7 +187,7 @@ class Delegate(QStyledItemDelegate):
setattr(editor, 'shortcut%d'%(x+1), seq) setattr(editor, 'shortcut%d'%(x+1), seq)
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
self.closeEditor.emit(editor, self.NoHint) self.closeEditor.emit(editor, QAbstractItemDelegate.EndEditHint.NoHint)
custom = [] custom = []
if editor.custom.isChecked(): if editor.custom.isChecked():
for x in ('1', '2'): for x in ('1', '2'):