Meshroom/meshroom/ui/components/clipboard.py
Candice Bentéjac ddda62a652 Add node to graph with Ctrl+V if valid node content is in the clipboard
Attempt to paste the clipboard's content in the graph when Ctrl+V is
pressed. If the clipboard contains a valid node description, add the
corresponding node to the graph.
Otherwise, do nothing.
2022-08-19 12:00:16 +02:00

24 lines
587 B
Python

from PySide2.QtCore import Slot, QObject
from PySide2.QtGui import QClipboard
class ClipboardHelper(QObject):
"""
Simple wrapper around a QClipboard with methods exposed as Slots for QML use.
"""
def __init__(self, parent=None):
super(ClipboardHelper, self).__init__(parent)
self._clipboard = QClipboard(parent=self)
@Slot(str)
def setText(self, value):
self._clipboard.setText(value)
@Slot(result=str)
def getText(self):
return self._clipboard.text()
@Slot()
def clear(self):
self._clipboard.clear()