本文整理汇总了Python中PyQt5.QtGui.QGuiApplication.clipboard方法的典型用法代码示例。如果您正苦于以下问题:Python QGuiApplication.clipboard方法的具体用法?Python QGuiApplication.clipboard怎么用?Python QGuiApplication.clipboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QGuiApplication
的用法示例。
在下文中一共展示了QGuiApplication.clipboard方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onClipboardChanged
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def onClipboardChanged(self, mode):
if mode == QClipboard.Clipboard:
if not QGuiApplication.clipboard().ownsClipboard():
self.clipboardTimer.start()
else:
self.clipboardTimer.stop()
elif mode == QClipboard.Selection:
if not QGuiApplication.clipboard().ownsSelection():
self.selectionTimer.start()
else:
self.selectionTimer.stop()
示例2: __init__
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def __init__(self, config_dict):
super().__init__()
self.config_dict = config_dict
self.clipboard = QGuiApplication.clipboard()
self.reconstruct = enable_rhc(config_dict["random_hit_chance"])(
self.reconstruct
)
self.clipboard.dataChanged.connect(self.reconstruct)
示例3: emitChanged
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def emitChanged(self, mode):
clipboard = QGuiApplication.clipboard()
mimeData = clipboard.mimeData()
data = {}
for format in self.formats:
if mimeData.hasFormat(format):
data[format] = mimeData.data(format)
self.changed.emit(data)
示例4: __init__
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def __init__(self):
QObject.__init__(self)
clipboard = QGuiApplication.clipboard()
clipboard.changed.connect(self.onClipboardChanged)
self.clipboardTimer = QTimer()
self.clipboardTimer.setInterval(500)
self.clipboardTimer.setSingleShot(True)
self.clipboardTimer.timeout.connect(self.onClipboardChangedAfterDelay)
self.selectionTimer = QTimer()
self.selectionTimer.setInterval(1000)
self.selectionTimer.setSingleShot(True)
self.selectionTimer.timeout.connect(self.onSelectionChangedAfterDelay)
self.formats = set([mimeText])
示例5: __init__
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def __init__(self, parent = None):
super().__init__(parent)
self.app = QGuiApplication.instance()
self._queue = deque()
self.frontendpy = parent
self._listener = threading.Thread(target = self.listenerThread, daemon = True,
name = "frontend communication listener")
self._listener.start()
tasks = sys.argv[1:]
if tasks:
self.createTasksAction(tasks)
self.urlExtractor = UrlExtractor(self)
self._clipboard = QGuiApplication.clipboard()
self.app.settings.applySettings.connect(self.slotWatchClipboardToggled)
示例6: getSelectedTextFunc
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
return getSelectedTextFunc(desktop)
lock = threading.Lock()
def textCopied():
with lock:
print("copiedText:" + getSelectedText());
sys.stdout.flush();
def selectingText():
previousSelectedText = None;
currentSelectedText = None;
while True:
currentSelectedText = getSelectedText();
if currentSelectedText and currentSelectedText != previousSelectedText:
with lock:
print("selectedText:" + currentSelectedText);
sys.stdout.flush();
previousSelectedText = currentSelectedText;
time.sleep(0.05);
t = threading.Thread(target=selectingText);
t.daemon = True;
t.start();
app = QGuiApplication(sys.argv);
clipboard = QGuiApplication.clipboard()
clipboard.dataChanged.connect(textCopied)
sys.exit(app.exec_())
示例7: Q_ARG
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
myObj = obj.findChild(QObject, "loginHandle")
QMetaObject.invokeMethod(myObj, "loginResult", Qt.QueuedConnection, Q_ARG(QVariant, string))
@pyqtSlot(str, str)
def login(self, email, password):
self.cw.authenticate(email, password)
@pyqtSlot()
def stop(self):
self.cw.stop()
sys.exit()
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
clipboard = app.clipboard()
# add icon
app_icon = QIcon()
app_icon.addFile(path.join("qml", "img", "logo.jpg"))
app.setWindowIcon(app_icon)
engine = QQmlApplicationEngine()
ctx = engine.rootContext()
py = QMLNameSpace(engine, clipboard)
ctx.setContextProperty("main", engine)
ctx.setContextProperty("py", py)
# engine.addImportPath(path.join(getcwd(), 'qml'))
engine.setImportPathList([path.join(getcwd(), "qml", "lib")])
示例8: copyText
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def copyText(self, text):
from PyQt5.QtGui import QGuiApplication
clip = QGuiApplication.clipboard()
clip.setText(text)
示例9: text
# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
def text(self, text):
clipboard = QGuiApplication.clipboard()
return clipboard.setText(text)