aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-27 09:57:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-27 12:12:43 +0200
commitf63d19c10f8d60a2acbe35e4f8ac2f7ae1ef017a (patch)
treeac9654f9752a350bad6afa0a868acf1103ac5b73 /examples
parent4d4f744c570d2feb79163051d2fd4c73336f1758 (diff)
Remove the macpasteboardmime example
QtMacExtras has been removed in Qt 6. Pick-to: 6.5 Task-number: PYSIDE-2206 Change-Id: I42af6f34d8f396415e83deae09b3de021fb580eb Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/macextras/macpasteboardmime/macpasteboardmime.py90
-rw-r--r--examples/macextras/macpasteboardmime/macpasteboardmime.pyproject3
2 files changed, 0 insertions, 93 deletions
diff --git a/examples/macextras/macpasteboardmime/macpasteboardmime.py b/examples/macextras/macpasteboardmime/macpasteboardmime.py
deleted file mode 100644
index f4aa3eee2..000000000
--- a/examples/macextras/macpasteboardmime/macpasteboardmime.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import sys
-from PySide6 import QtCore, QtWidgets
-
-try:
- from PySide6 import QtMacExtras
-except ImportError:
- app = QtWidgets.QApplication(sys.argv)
- messageBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "QtMacExtras macpasteboardmime",
- "This exampe only runs on macOS and QtMacExtras must be installed to run this example.",
- QtWidgets.QMessageBox.Close)
- messageBox.exec()
- sys.exit(1)
-
-
-class VCardMime(QtMacExtras.QMacPasteboardMime):
- def __init__(self, t=QtMacExtras.QMacPasteboardMime.MIME_ALL):
- super().__init__(t)
-
- def convertorName(self):
- return "VCardMime"
-
- def canConvert(self, mime, flav):
- if self.mimeFor(flav) == mime:
- return True
- else:
- return False
-
- def mimeFor(self, flav):
- if flav == "public.vcard":
- return "application/x-mycompany-VCard"
- else:
- return ""
-
- def flavorFor(self, mime):
- if mime == "application/x-mycompany-VCard":
- return "public.vcard"
- else:
- return ""
-
- def convertToMime(self, mime, data, flav):
- data_all = QtCore.QByteArray()
- for i in data:
- data_all += i
- return data_all
-
- def convertFromMime(mime, data, flav):
- # Todo: implement!
- return []
-
-
-class TestWidget(QtWidgets.QWidget):
- def __init__(self, parent=None):
- super().__init__(parent)
- self.vcardMime = VCardMime()
- self.setAcceptDrops(True)
-
- self.label1 = QtWidgets.QLabel()
- self.label2 = QtWidgets.QLabel()
-
- layout = QtWidgets.QVBoxLayout()
- layout.addWidget(self.label1)
- layout.addWidget(self.label2)
- self.setLayout(layout)
-
- self.label1.setText("Please drag a \"VCard\" from Contacts application, normally a name in the list, and drop here.")
-
- def dragEnterEvent(self, e):
- e.accept()
-
- def dropEvent(self, e):
- e.accept()
- self.contentsDropEvent(e)
-
- def contentsDropEvent(self, e):
- if e.mimeData().hasFormat("application/x-mycompany-VCard"):
- s = e.mimeData().data("application/x-mycompany-VCard")
- # s now contains text of vcard
- self.label2.setText(str(s))
- e.acceptProposedAction()
-
-
-if __name__ == '__main__':
- app = QtWidgets.QApplication(sys.argv)
- QtMacExtras.qRegisterDraggedTypes(["public.vcard"])
- wid1 = TestWidget()
- wid1.show()
- sys.exit(app.exec())
diff --git a/examples/macextras/macpasteboardmime/macpasteboardmime.pyproject b/examples/macextras/macpasteboardmime/macpasteboardmime.pyproject
deleted file mode 100644
index d559b7ca4..000000000
--- a/examples/macextras/macpasteboardmime/macpasteboardmime.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["macpasteboardmime.py"]
-}