Qt: schedule tooltip in do_copy
This commit is contained in:
@@ -1082,13 +1082,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
|
|||||||
from .receive_tab import ReceiveTab
|
from .receive_tab import ReceiveTab
|
||||||
return ReceiveTab(self)
|
return ReceiveTab(self)
|
||||||
|
|
||||||
def do_copy(self, content: str, *, title: str = None) -> None:
|
def do_copy(self, text: str, *, title: str = None) -> None:
|
||||||
self.app.clipboard().setText(content)
|
self.app.clipboard().setText(text)
|
||||||
if title is None:
|
message = _("Text copied to Clipboard") if title is None else _("{} copied to Clipboard").format(title)
|
||||||
tooltip_text = _("Text copied to clipboard")
|
# tooltip cannot be displayed immediately when called from a menu; wait 200ms
|
||||||
else:
|
self.gui_object.timer.singleShot(200, lambda: QToolTip.showText(QCursor.pos(), message, self))
|
||||||
tooltip_text = _("{} copied to clipboard").format(title)
|
|
||||||
QToolTip.showText(QCursor.pos(), tooltip_text, self)
|
|
||||||
|
|
||||||
def toggle_qr_window(self):
|
def toggle_qr_window(self):
|
||||||
from . import qrwindow
|
from . import qrwindow
|
||||||
|
|||||||
Reference in New Issue
Block a user