1
0

qt PayToEdit: always add context menu items

fixes regression from https://github.com/spesmilo/electrum/pull/8462
This commit is contained in:
SomberNight
2023-08-09 16:00:09 +00:00
parent 2f2be1a606
commit c5493a354d
2 changed files with 6 additions and 2 deletions

View File

@@ -167,6 +167,7 @@ class PayToEdit(QWidget, Logger, GenericInputHandler):
)
self.text_edit.contextMenuEvent = partial(editor_contextMenuEvent, self.text_edit, self)
self.line_edit.contextMenuEvent = partial(editor_contextMenuEvent, self.line_edit, self)
self.edit_timer = QTimer(self)
self.edit_timer.setSingleShot(True)

View File

@@ -15,7 +15,8 @@ from typing import (NamedTuple, Callable, Optional, TYPE_CHECKING, Union, List,
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtGui import (QFont, QColor, QCursor, QPixmap, QStandardItem, QImage,
QPalette, QIcon, QFontMetrics, QShowEvent, QPainter, QHelpEvent, QMouseEvent)
QPalette, QIcon, QFontMetrics, QShowEvent, QPainter, QHelpEvent, QMouseEvent,
QContextMenuEvent)
from PyQt5.QtCore import (Qt, QPersistentModelIndex, QModelIndex, pyqtSignal,
QCoreApplication, QItemSelectionModel, QThread,
QSortFilterProxyModel, QSize, QLocale, QAbstractItemModel,
@@ -38,6 +39,8 @@ from electrum.qrreader import MissingQrDetectionLib
if TYPE_CHECKING:
from .main_window import ElectrumWindow
from .installwizard import InstallWizard
from .paytoedit import PayToEdit
from electrum.simple_config import SimpleConfig
@@ -529,7 +532,7 @@ def get_iconname_camera() -> str:
return "camera_white.png" if ColorScheme.dark_scheme else "camera_dark.png"
def editor_contextMenuEvent(self, p, e):
def editor_contextMenuEvent(self, p: 'PayToEdit', e: 'QContextMenuEvent') -> None:
m = self.createStandardContextMenu()
m.addSeparator()
m.addAction(read_QIcon(get_iconname_camera()), _("Read QR code with camera"), p.on_qr_from_camera_input_btn)