mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More PyQt6 nonsense
This commit is contained in:
parent
1be8c50cc1
commit
7c28360d71
@ -12,7 +12,7 @@ from gettext import pgettext
|
|||||||
from qt.core import (QObject, QKeySequence, QAbstractItemModel, QModelIndex, QItemSelectionModel,
|
from qt.core import (QObject, QKeySequence, QAbstractItemModel, QModelIndex, QItemSelectionModel,
|
||||||
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame, QAbstractItemView, QMenu,
|
Qt, QStyledItemDelegate, QTextDocument, QStyle, pyqtSignal, QFrame, QAbstractItemView, QMenu,
|
||||||
QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout, QAbstractItemDelegate,
|
QApplication, QSize, QRectF, QWidget, QTreeView, QHBoxLayout, QVBoxLayout, QAbstractItemDelegate,
|
||||||
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon, QEvent, sip)
|
QGridLayout, QLabel, QRadioButton, QPushButton, QToolButton, QIcon, QEvent, sip, QKeyCombination)
|
||||||
|
|
||||||
from calibre.utils.config import JSONConfig
|
from calibre.utils.config import JSONConfig
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
@ -31,7 +31,7 @@ class NameConflict(ValueError):
|
|||||||
|
|
||||||
|
|
||||||
def keysequence_from_event(ev): # {{{
|
def keysequence_from_event(ev): # {{{
|
||||||
k, mods = ev.key(), ev.modifiers()
|
k, mods = ev.keyCombination().key(), ev.modifiers()
|
||||||
if k in (
|
if k in (
|
||||||
0, Qt.Key.Key_unknown, Qt.Key.Key_Shift, Qt.Key.Key_Control, Qt.Key.Key_Alt,
|
0, Qt.Key.Key_unknown, Qt.Key.Key_Shift, Qt.Key.Key_Control, Qt.Key.Key_Alt,
|
||||||
Qt.Key.Key_Meta, Qt.Key.Key_AltGr, Qt.Key.Key_CapsLock, Qt.Key.Key_NumLock,
|
Qt.Key.Key_Meta, Qt.Key.Key_AltGr, Qt.Key.Key_CapsLock, Qt.Key.Key_NumLock,
|
||||||
@ -42,7 +42,7 @@ def keysequence_from_event(ev): # {{{
|
|||||||
# Something like Shift+* or Shift+> we have to remove the shift,
|
# Something like Shift+* or Shift+> we have to remove the shift,
|
||||||
# since it is included in keycode.
|
# since it is included in keycode.
|
||||||
mods = mods & ~Qt.KeyboardModifier.ShiftModifier
|
mods = mods & ~Qt.KeyboardModifier.ShiftModifier
|
||||||
return QKeySequence(k | int(mods))
|
return QKeySequence(QKeyCombination(mods, k))
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user