Meshroom/meshroom/ui/components/clipboard.py
Yann Lanthony 438622a14b
[ui] Introduce ClipboardHelper for copying to clipboard from QML
* add ClipboardHelper class that contains a QClipboard and exposes its method as Slots
* use Clipboard instead of hidden TextEdit where meaningful
2019-05-07 11:47:09 +02:00

20 lines
503 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()
def clear(self):
self._clipboard.clear()