mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 10:17:27 +02:00
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.
24 lines
587 B
Python
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()
|