qclipboard.sip 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // qclipboard.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QClipboard : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qclipboard.h>
  25. %End
  26. explicit QClipboard(QObject *parent /TransferThis/);
  27. virtual ~QClipboard();
  28. public:
  29. enum Mode
  30. {
  31. Clipboard,
  32. Selection,
  33. FindBuffer,
  34. };
  35. void clear(QClipboard::Mode mode = QClipboard::Clipboard);
  36. bool supportsFindBuffer() const;
  37. bool supportsSelection() const;
  38. bool ownsClipboard() const;
  39. bool ownsFindBuffer() const;
  40. bool ownsSelection() const;
  41. QString text(QClipboard::Mode mode = QClipboard::Clipboard) const;
  42. SIP_PYTUPLE text(const QString &subtype, QClipboard::Mode mode = QClipboard::Clipboard) const /TypeHint="Tuple[QString, QString]"/;
  43. %MethodCode
  44. QString *text;
  45. QString *subtype = new QString(*a0);
  46. Py_BEGIN_ALLOW_THREADS
  47. text = new QString(sipCpp->text(*subtype, a1));
  48. Py_END_ALLOW_THREADS
  49. PyObject *text_obj = sipConvertFromNewType(text, sipType_QString, NULL);
  50. PyObject *subtype_obj = sipConvertFromNewType(subtype, sipType_QString, NULL);
  51. if (text_obj && subtype_obj)
  52. sipRes = PyTuple_Pack(2, text_obj, subtype_obj);
  53. Py_XDECREF(text_obj);
  54. Py_XDECREF(subtype_obj);
  55. %End
  56. void setText(const QString &, QClipboard::Mode mode = QClipboard::Clipboard);
  57. const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) const;
  58. void setMimeData(QMimeData *data /GetWrapper/, QClipboard::Mode mode = QClipboard::Clipboard);
  59. %MethodCode
  60. Py_BEGIN_ALLOW_THREADS
  61. sipCpp->setMimeData(a0, a1);
  62. Py_END_ALLOW_THREADS
  63. // Transfer ownership to C++ and make sure the Python object stays alive by
  64. // giving it a reference to itself. The cycle will be broken by QMimeData's
  65. // virtual dtor. The reason we don't do the obvious and just use /Transfer/ is
  66. // that the QClipboard Python object we would transfer ownership to is likely
  67. // to be garbage collected immediately afterwards.
  68. sipTransferTo(a0Wrapper, a0Wrapper);
  69. %End
  70. QImage image(QClipboard::Mode mode = QClipboard::Clipboard) const;
  71. QPixmap pixmap(QClipboard::Mode mode = QClipboard::Clipboard) const;
  72. void setImage(const QImage &, QClipboard::Mode mode = QClipboard::Clipboard);
  73. void setPixmap(const QPixmap &, QClipboard::Mode mode = QClipboard::Clipboard);
  74. signals:
  75. void changed(QClipboard::Mode mode);
  76. void dataChanged();
  77. void findBufferChanged();
  78. void selectionChanged();
  79. };