Улучшен дизайн кнопок SpinBox: добавлены современные стили, улучшена визуальная обратная связь, добавлены SVG иконки, оптимизированы размеры и отступы, улучшена читаемость значени

This commit is contained in:
kromskii2 committed 2025-03-14 19:25:58 +07:00
1 parent 2b9165771b
commit 29dce906c5
6110 files changed
+775979

No files matched your search

@@ -0,0 +1,6 @@
# Automatically generated configuration for PyQt6.QtCore.
sip-version = "6.10.0"
sip-abi-version = "13.8"
module-tags = ["Qt_6_8_0", "Windows"]
module-disabled-features = []
@@ -0,0 +1,219 @@
// QtCoremod.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%Module(name=PyQt6.QtCore, call_super_init=True, default_VirtualErrorHandler=PyQt6, keyword_arguments="Optional", use_limited_api=True, py_ssize_t_clean=True)
%Timeline {Qt_6_0_0 Qt_6_1_0 Qt_6_2_0 Qt_6_3_0 Qt_6_4_0 Qt_6_5_0 Qt_6_6_0 Qt_6_7_0 Qt_6_8_0}
%Platforms {Android iOS Linux macOS WebAssembly Windows}
%Feature PyQt_Accessibility
%Feature PyQt_SessionManager
%Feature PyQt_SSL
%Feature PyQt_qreal_double
%Feature PyQt_PrintDialog
%Feature PyQt_Printer
%Feature PyQt_PrintPreviewWidget
%Feature PyQt_PrintPreviewDialog
%Feature PyQt_RawFont
%Feature PyQt_OpenGL
%Feature PyQt_OpenGL_ES2
%Feature PyQt_Process
%Feature PyQt_WebChannel
%Feature PyQt_DTLS
%Feature PyQt_Permissions
%Feature PyQt_Vulkan
%Copying
Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
This file is part of PyQt6.
This file may be used under the terms of the GNU General Public License
version 3.0 as published by the Free Software Foundation and appearing in
the file LICENSE included in the packaging of this file. Please review the
following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you do not wish to use this file under the terms of the GPL version 3.0
then you may purchase a commercial license. For more information contact
info@riverbankcomputing.com.
This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%End
%Plugin PyQt6
%DefaultEncoding "ASCII"
%Include(name=pyqt-internal.sip5, optional=True)
%Include(name=pyqt-gpl.sip5, optional=True)
%Include(name=pyqt-commercial.sip5, optional=True)
%DefaultSupertype PyQt6.sip.simplewrapper
int PYQT_VERSION;
const char *PYQT_VERSION_STR;
%ModuleCode
static int PYQT_VERSION = 0x060801;
static const char *PYQT_VERSION_STR = "6.8.1";
%End
%Include qglobal.sip
%Include qtenvironmentvariables.sip
%Include qtversion.sip
%Include qnamespace.sip
%Include qabstractanimation.sip
%Include qabstracteventdispatcher.sip
%Include qabstractitemmodel.sip
%Include qabstractnativeeventfilter.sip
%Include qabstractproxymodel.sip
%Include qanimationgroup.sip
%Include qbasictimer.sip
%Include qbitarray.sip
%Include qbuffer.sip
%Include qbytearray.sip
%Include qbytearrayalgorithms.sip
%Include qbytearraymatcher.sip
%Include qcalendar.sip
%Include qcborcommon.sip
%Include qcborstreamreader.sip
%Include qcborstreamwriter.sip
%Include qchar.sip
%Include qcollator.sip
%Include qcommandlineoption.sip
%Include qcommandlineparser.sip
%Include qconcatenatetablesproxymodel.sip
%Include qcoreapplication.sip
%Include qcoreevent.sip
%Include qcryptographichash.sip
%Include qdatastream.sip
%Include qdatetime.sip
%Include qdeadlinetimer.sip
%Include qdir.sip
%Include qdiriterator.sip
%Include qeasingcurve.sip
%Include qelapsedtimer.sip
%Include qeventloop.sip
%Include qfile.sip
%Include qfiledevice.sip
%Include qfileinfo.sip
%Include qfileselector.sip
%Include qfilesystemwatcher.sip
%Include qidentityproxymodel.sip
%Include qiodevice.sip
%Include qiodevicebase.sip
%Include qitemselectionmodel.sip
%Include qjsondocument.sip
%Include qjsonvalue.sip
%Include qlibrary.sip
%Include qlibraryinfo.sip
%Include qline.sip
%Include qlocale.sip
%Include qlockfile.sip
%Include qlogging.sip
%Include qloggingcategory.sip
%Include qmargins.sip
%Include qmessageauthenticationcode.sip
%Include qmetaobject.sip
%Include qmetatype.sip
%Include qmimedata.sip
%Include qmimedatabase.sip
%Include qmimetype.sip
%Include qmutex.sip
%Include qnumeric.sip
%Include qobject.sip
%Include qobjectcleanuphandler.sip
%Include qobjectdefs.sip
%Include qoperatingsystemversion.sip
%Include qparallelanimationgroup.sip
%Include qpauseanimation.sip
%Include qpermissions.sip
%Include qpropertyanimation.sip
%Include qpluginloader.sip
%Include qpoint.sip
%Include qprocess.sip
%Include qrandom.sip
%Include qreadwritelock.sip
%Include qrect.sip
%Include qregularexpression.sip
%Include qresource.sip
%Include qrunnable.sip
%Include qsavefile.sip
%Include qsemaphore.sip
%Include qsequentialanimationgroup.sip
%Include qsettings.sip
%Include qsharedmemory.sip
%Include qsignalmapper.sip
%Include qsize.sip
%Include qsocketnotifier.sip
%Include qsortfilterproxymodel.sip
%Include qstandardpaths.sip
%Include qstorageinfo.sip
%Include qstringconverter_base.sip
%Include qstringconverter.sip
%Include qstringlistmodel.sip
%Include qsysinfo.sip
%Include qsystemsemaphore.sip
%Include qtemporarydir.sip
%Include qtemporaryfile.sip
%Include qtextboundaryfinder.sip
%Include qtextstream.sip
%Include qthread.sip
%Include qthreadpool.sip
%Include qtimeline.sip
%Include qtimer.sip
%Include qtimezone.sip
%Include qtipccommon.sip
%Include qtranslator.sip
%Include qtransposeproxymodel.sip
%Include qtyperevision.sip
%Include qtypes.sip
%Include qurl.sip
%Include qurlquery.sip
%Include quuid.sip
%Include qvariant.sip
%Include qvariantanimation.sip
%Include qversionnumber.sip
%Include qwaitcondition.sip
%Include qxmlstream.sip
%Include qyieldcpu.sip
%Include qanystringview.sip
%Include qbytearraylist.sip
%Include qbytearrayview.sip
%Include qflags.sip
%Include qjsonarray.sip
%Include qjsonobject.sip
%Include qmutexlocker.sip
%Include qpycore_qhash.sip
%Include qpycore_qlist.sip
%Include qpycore_qmap.sip
%Include qpycore_qset.sip
%Include qpycore_std_optional.sip
%Include qpycore_std_pair.sip
%Include qpycore_virtual_error_handler.sip
%Include qstring.sip
%Include qstringlist.sip
%Include qstringview.sip
%Include qwineventnotifier.sip
@@ -0,0 +1 @@
%License(type="gpl")
@@ -0,0 +1,82 @@
// qabstractanimation.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QAbstractAnimation : public QObject
{
%TypeHeaderCode
#include <qabstractanimation.h>
%End
public:
enum Direction
{
Forward,
Backward,
};
enum State
{
Stopped,
Paused,
Running,
};
enum DeletionPolicy
{
KeepWhenStopped,
DeleteWhenStopped,
};
QAbstractAnimation(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractAnimation();
QAbstractAnimation::State state() const;
QAnimationGroup *group() const;
QAbstractAnimation::Direction direction() const;
void setDirection(QAbstractAnimation::Direction direction);
int currentTime() const;
int currentLoopTime() const;
int loopCount() const;
void setLoopCount(int loopCount);
int currentLoop() const;
virtual int duration() const = 0;
int totalDuration() const;
signals:
void finished();
void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
void currentLoopChanged(int currentLoop);
void directionChanged(QAbstractAnimation::Direction);
public slots:
void start(QAbstractAnimation::DeletionPolicy policy = QAbstractAnimation::KeepWhenStopped);
void pause();
void resume();
void setPaused(bool);
void stop();
void setCurrentTime(int msecs);
protected:
virtual bool event(QEvent *event);
virtual void updateCurrentTime(int currentTime) = 0;
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
virtual void updateDirection(QAbstractAnimation::Direction direction);
};
@@ -0,0 +1,67 @@
// qabstracteventdispatcher.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Qt v6.8 introduced QAbstractEventDispatcherV2 as a temporary class intended to
// aid porting to Qt7 (where all timers will be based on std::chrono). We choose
// not to implement them as PyQt is likely to use Python ints anyway.
class QAbstractEventDispatcher : public QObject /Abstract/
{
%TypeHeaderCode
#include <qabstracteventdispatcher.h>
%End
public:
struct TimerInfo
{
%TypeHeaderCode
#include <qabstracteventdispatcher.h>
%End
int timerId;
int interval;
Qt::TimerType timerType;
TimerInfo(int id, int i, Qt::TimerType t);
};
explicit QAbstractEventDispatcher(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractEventDispatcher();
static QAbstractEventDispatcher *instance(QThread *thread = 0);
virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0 /ReleaseGIL/;
int registerTimer(qint64 interval, Qt::TimerType timerType, QObject *object);
virtual void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) = 0;
virtual bool unregisterTimer(int timerId) = 0;
virtual bool unregisterTimers(QObject *object) = 0;
virtual QList<QAbstractEventDispatcher::TimerInfo> registeredTimers(QObject *object) const = 0;
virtual void wakeUp() = 0;
virtual void interrupt() = 0;
virtual void startingUp();
virtual void closingDown();
virtual int remainingTime(int timerId) = 0;
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj);
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
bool filterNativeEvent(const QByteArray &eventType, void *message, qintptr *result /Out/);
signals:
void aboutToBlock();
void awake();
};
@@ -0,0 +1,446 @@
// qabstractitemmodel.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QModelIndex
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
QModelIndex();
int row() const;
int column() const;
QVariant data(int role = Qt::DisplayRole) const;
Qt::ItemFlags flags() const;
SIP_PYOBJECT internalPointer() const;
%MethodCode
sipRes = reinterpret_cast<PyObject *>(sipCpp->internalPointer());
if (!sipRes)
sipRes = Py_None;
Py_INCREF(sipRes);
%End
SIP_PYOBJECT internalId() const /TypeHint="int"/;
%MethodCode
// Python needs to treat the result as an unsigned value (which may not happen
// on 64 bit systems). Instead we get the real value as it is stored (as a
// void *) and let Python convert that.
sipRes = PyLong_FromVoidPtr(sipCpp->internalPointer());
%End
const QAbstractItemModel *model() const;
bool isValid() const;
QModelIndex parent() const;
QModelIndex sibling(int arow, int acolumn) const;
QModelIndex siblingAtColumn(int column) const;
QModelIndex siblingAtRow(int row) const;
%If (- Qt_6_8_0)
bool operator==(const QModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator<(const QModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QModelIndex &other) const;
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
class QPersistentModelIndex
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
QPersistentModelIndex();
QPersistentModelIndex(const QModelIndex &index);
QPersistentModelIndex(const QPersistentModelIndex &other);
~QPersistentModelIndex();
int row() const;
int column() const;
QVariant data(int role = Qt::DisplayRole) const;
Qt::ItemFlags flags() const;
QModelIndex parent() const;
QModelIndex sibling(int row, int column) const;
const QAbstractItemModel *model() const;
bool isValid() const;
void swap(QPersistentModelIndex &other /Constrained/);
operator QModelIndex() const;
%If (- Qt_6_8_0)
bool operator<(const QPersistentModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator==(const QPersistentModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator==(const QModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QPersistentModelIndex &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QModelIndex &other) const;
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
typedef QList<QModelIndex> QModelIndexList;
class QAbstractItemModel : public QObject
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
enum LayoutChangeHint
{
NoLayoutChangeHint,
VerticalSortHint,
HorizontalSortHint,
};
explicit QAbstractItemModel(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractItemModel();
bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const = 0;
virtual QModelIndex parent(const QModelIndex &child) const = 0;
QObject *parent() const;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual Qt::DropActions supportedDropActions() const;
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
virtual void fetchMore(const QModelIndex &parent);
virtual bool canFetchMore(const QModelIndex &parent) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
virtual QModelIndex buddy(const QModelIndex &index) const;
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const;
virtual QSize span(const QModelIndex &index) const;
signals:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int> &roles = QList<int>());
void headerDataChanged(Qt::Orientation orientation, int first, int last);
void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
void layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint);
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void rowsInserted(const QModelIndex &parent, int first, int last);
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
void rowsRemoved(const QModelIndex &parent, int first, int last);
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void columnsInserted(const QModelIndex &parent, int first, int last);
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
void columnsRemoved(const QModelIndex &parent, int first, int last);
void modelAboutToBeReset();
void modelReset();
public slots:
virtual bool submit();
virtual void revert();
protected:
void encodeData(const QModelIndexList &indexes, QDataStream &stream) const;
bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream);
void beginInsertRows(const QModelIndex &parent, int first, int last);
void endInsertRows();
void beginRemoveRows(const QModelIndex &parent, int first, int last);
void endRemoveRows();
void beginInsertColumns(const QModelIndex &parent, int first, int last);
void endInsertColumns();
void beginRemoveColumns(const QModelIndex &parent, int first, int last);
void endRemoveColumns();
QModelIndexList persistentIndexList() const;
void changePersistentIndex(const QModelIndex &from, const QModelIndex &to);
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to);
public:
bool insertRow(int row, const QModelIndex &parent = QModelIndex());
bool insertColumn(int column, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex());
bool removeColumn(int column, const QModelIndex &parent = QModelIndex());
virtual Qt::DropActions supportedDragActions() const;
virtual QHash<int, QByteArray> roleNames() const;
protected:
QModelIndex createIndex(int row, int column, SIP_PYOBJECT object = 0) const [QModelIndex (int row, int column, const void *object = 0)];
%MethodCode
// The Qt API is broken (and won't be fixed as it would break binary
// compatibility) regarding the internal id of a model index on different
// architectures (32 vs 64 bits). We choose to work around the breakage as it
// is fairly subtle and continues to catch people out. Instead of letting Qt
// convert betweed an integer id and a pointer id (the internal format used by
// Qt) we let Python do it.
void *ptr;
if (a2)
{
// Try and convert it to a Python long and fallback to the object's
// address if it fails.
ptr = PyLong_AsVoidPtr(a2);
if (PyErr_Occurred())
{
PyErr_Clear();
ptr = a2;
}
}
else
{
ptr = 0;
}
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = new QModelIndex(sipCpp->createIndex(a0, a1, ptr));
#else
sipRes = new QModelIndex(sipCpp->sipProtect_createIndex(a0, a1, ptr));
#endif
%End
signals:
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn);
void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
protected:
bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow);
void endMoveRows();
bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn);
void endMoveColumns();
void beginResetModel() /ReleaseGIL/;
void endResetModel() /ReleaseGIL/;
protected slots:
virtual void resetInternalData();
public:
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const;
virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild);
virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild);
bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild);
bool moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild);
enum class CheckIndexOption /BaseType=Flag/
{
NoOption,
IndexIsValid,
DoNotUseParent,
ParentIsInvalid,
};
typedef QFlags<QAbstractItemModel::CheckIndexOption> CheckIndexOptions;
bool checkIndex(const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options = QAbstractItemModel::CheckIndexOption::NoOption) const;
virtual bool clearItemData(const QModelIndex &index);
virtual void multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const;
};
class QAbstractTableModel : public QAbstractItemModel
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
explicit QAbstractTableModel(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractTableModel();
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
QObject *parent() const;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
private:
virtual bool hasChildren(const QModelIndex &parent) const;
virtual QModelIndex parent(const QModelIndex &child) const;
};
class QAbstractListModel : public QAbstractItemModel
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
explicit QAbstractListModel(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractListModel();
virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
QObject *parent() const;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
private:
virtual int columnCount(const QModelIndex &parent) const;
virtual bool hasChildren(const QModelIndex &parent) const;
virtual QModelIndex parent(const QModelIndex &child) const;
};
class QModelRoleData
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End
public:
explicit QModelRoleData(int role);
int role() const;
const QVariant &data() const;
void setData(const QVariant &data);
void clearData();
};
class QModelRoleDataSpan
{
%TypeHeaderCode
// The capsule destructor for a QModelRoleData array.
static void qpycore_gc_modelroledata(PyObject *mrd_obj);
%End
%TypeCode
// The capsule destructor for a QModelRoleData array.
static void qpycore_gc_modelroledata(PyObject *mrd_obj)
{
delete[] reinterpret_cast<QList<QModelRoleData>* >(PyCapsule_GetPointer(mrd_obj, NULL));
}
%End
public:
QModelRoleDataSpan();
QModelRoleDataSpan(QModelRoleData &modelRoleData);
QModelRoleDataSpan(QList<QModelRoleData> modelRoleData);
%MethodCode
PyObject *a0cap = PyCapsule_New(a0, NULL, qpycore_gc_modelroledata);
if (a0cap)
{
sipSetUserObject((sipSimpleWrapper *)sipSelf, a0cap);
sipCpp = new QModelRoleDataSpan(*a0);
}
%End
qsizetype size() const;
qsizetype length() const /__len__/;
QModelRoleData *data() const;
QModelRoleData *begin() const;
QModelRoleData *end() const;
QModelRoleData &operator[](qsizetype index) const;
QVariant *dataForRole(int role) const;
};
%If (Qt_6_8_0 -)
bool operator>=(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>=(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>=(const QModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>(const QModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<(const QModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QPersistentModelIndex &lhs, const QModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QModelIndex &lhs, const QModelIndex &rhs);
%End
@@ -0,0 +1,36 @@
// qabstractnativeeventfilter.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QAbstractNativeEventFilter
{
%TypeHeaderCode
#include <qabstractnativeeventfilter.h>
%End
public:
QAbstractNativeEventFilter();
virtual ~QAbstractNativeEventFilter();
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result /Out/) = 0;
private:
QAbstractNativeEventFilter(const QAbstractNativeEventFilter &);
};
@@ -0,0 +1,67 @@
// qabstractproxymodel.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QAbstractProxyModel : public QAbstractItemModel
{
%TypeHeaderCode
#include <qabstractproxymodel.h>
%End
public:
explicit QAbstractProxyModel(QObject *parent /TransferThis/ = 0);
virtual ~QAbstractProxyModel();
virtual void setSourceModel(QAbstractItemModel *sourceModel /KeepReference/);
QAbstractItemModel *sourceModel() const;
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0;
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0;
virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
virtual bool submit();
virtual void revert();
virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
virtual QMap<int, QVariant> itemData(const QModelIndex &index) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
virtual QModelIndex buddy(const QModelIndex &index) const;
virtual bool canFetchMore(const QModelIndex &parent) const;
virtual void fetchMore(const QModelIndex &parent);
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
virtual QSize span(const QModelIndex &index) const;
virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/;
virtual QStringList mimeTypes() const;
virtual Qt::DropActions supportedDropActions() const;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
signals:
void sourceModelChanged();
public:
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual Qt::DropActions supportedDragActions() const;
virtual bool clearItemData(const QModelIndex &index);
virtual QHash<int, QByteArray> roleNames() const;
};
@@ -0,0 +1,43 @@
// qanimationgroup.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QAnimationGroup : public QAbstractAnimation
{
%TypeHeaderCode
#include <qanimationgroup.h>
%End
public:
QAnimationGroup(QObject *parent /TransferThis/ = 0);
virtual ~QAnimationGroup();
QAbstractAnimation *animationAt(int index) const;
int animationCount() const;
int indexOfAnimation(QAbstractAnimation *animation) const;
void addAnimation(QAbstractAnimation *animation /Transfer/);
void insertAnimation(int index, QAbstractAnimation *animation /Transfer/);
void removeAnimation(QAbstractAnimation *animation /TransferBack/);
QAbstractAnimation *takeAnimation(int index) /TransferBack/;
void clear();
protected:
virtual bool event(QEvent *event);
};
@@ -0,0 +1,92 @@
// This is the SIP interface definition for the QAnyStringView mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_4_0 -)
%MappedType QAnyStringView /AllowNone, TypeHint="Union[QByteArray, QString]",TypeHintValue="''"/
{
%TypeHeaderCode
#include <qanystringview.h>
%End
%TypeCode
struct PyQtAnyStringState
{
const sipTypeDef *instance_type; // The instance's generated type.
void *instance; // Either the QByteArray or QString.
int instance_state; // The state of the instance conversion.
};
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
return sipCanConvertToType(sipPy, sipType_QString, 0) ||
sipCanConvertToType(sipPy, sipType_QByteArray, SIP_NOT_NONE);
PyQtAnyStringState *state = new PyQtAnyStringState;
if (sipCanConvertToType(sipPy, sipType_QString, 0))
{
QString *qs = reinterpret_cast<QString *>(
sipConvertToType(sipPy, sipType_QString, sipTransferObj, 0,
&state->instance_state, sipIsErr));
if (*sipIsErr)
return 0;
*sipCppPtr = new QAnyStringView(*qs);
state->instance_type = sipType_QString;
state->instance = qs;
}
else
{
QByteArray *qba = reinterpret_cast<QByteArray *>(
sipConvertToType(sipPy, sipType_QByteArray, sipTransferObj,
SIP_NOT_NONE, &state->instance_state, sipIsErr));
if (*sipIsErr)
return 0;
*sipCppPtr = new QAnyStringView(*qba);
state->instance_type = sipType_QByteArray;
state->instance = qba;
}
*sipUserStatePtr = state;
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
return qpycore_PyObject_FromQString(sipCpp->toString());
%End
%ReleaseCode
delete sipCpp;
PyQtAnyStringState *state = reinterpret_cast<PyQtAnyStringState *>(sipUserState);
sipReleaseType(state->instance, state->instance_type, state->instance_state);
delete state;
%End
};
%End
@@ -0,0 +1,48 @@
// qbasictimer.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QBasicTimer
{
%TypeHeaderCode
#include <qbasictimer.h>
%End
public:
QBasicTimer();
~QBasicTimer();
bool isActive() const;
int timerId() const;
void start(int msec, Qt::TimerType timerType, QObject *obj);
void start(int msec, QObject *obj);
void stop();
void swap(QBasicTimer &other /Constrained/);
%If (Qt_6_8_0 -)
int id() const;
%MethodCode
sipRes = qToUnderlying<Qt::TimerId>(sipCpp->id());
%End
%End
private:
QBasicTimer(const QBasicTimer &);
};
@@ -0,0 +1,95 @@
// qbitarray.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QBitArray
{
%TypeHeaderCode
#include <qbitarray.h>
%End
%TypeCode
// This is needed by __hash__().
#include <qhash.h>
%End
public:
QBitArray();
QBitArray(qsizetype size, bool value = false);
QBitArray(const QBitArray &other);
qsizetype size() const;
qsizetype count() const /__len__/;
qsizetype count(bool on) const;
bool isEmpty() const;
bool isNull() const;
void resize(qsizetype size);
void detach();
bool isDetached() const;
void clear();
QBitArray &operator&=(const QBitArray &);
QBitArray &operator|=(const QBitArray &);
QBitArray &operator^=(const QBitArray &);
%If (- Qt_6_7_0)
// This was changed to be a global operator in Qt v6.7 but this isn't supported by SIP v6.8.
QBitArray operator~() const;
%End
%If (- Qt_6_8_0)
bool operator==(const QBitArray &a) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QBitArray &a) const;
%End
void fill(bool val, qsizetype first, qsizetype last);
bool fill(bool val, qsizetype size = -1);
void truncate(qsizetype pos);
bool testBit(qsizetype i) const;
void setBit(qsizetype i);
void setBit(qsizetype i, bool val);
void clearBit(qsizetype i);
bool toggleBit(qsizetype i);
bool operator[](qsizetype i) const;
bool at(qsizetype i) const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
void swap(QBitArray &other /Constrained/);
SIP_PYOBJECT bits() const /TypeHint="bytes"/;
%MethodCode
return PyBytes_FromStringAndSize(sipCpp->bits(), (sipCpp->size() + 7) / 8);
%End
static QBitArray fromBits(const char *data /Encoding="None"/, Py_ssize_t len) [QBitArray (const char *data, qsizetype len)];
quint32 toUInt32(QSysInfo::Endian endianness, bool *ok = 0) const;
};
QBitArray operator&(const QBitArray &, const QBitArray &);
QBitArray operator|(const QBitArray &, const QBitArray &);
QBitArray operator^(const QBitArray &, const QBitArray &);
QDataStream &operator<<(QDataStream &, const QBitArray &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QBitArray & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator!=(const QBitArray &lhs, const QBitArray &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QBitArray &lhs, const QBitArray &rhs);
%End
@@ -0,0 +1,114 @@
// qbuffer.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QBuffer : public QIODevice
{
%TypeHeaderCode
#include <qbuffer.h>
%End
public:
explicit QBuffer(QObject *parent /TransferThis/ = 0);
QBuffer(QByteArray *byteArray /Constrained/, QObject *parent /TransferThis/ = 0);
virtual ~QBuffer();
QByteArray &buffer();
const QByteArray &data() const;
void setBuffer(QByteArray *a /Constrained/);
void setData(const QByteArray &data);
%If (- Qt_6_5_0)
void setData(const char *adata /Array/, int alen /ArraySize/);
%End
%If (Qt_6_5_0 -)
void setData(const char *data /Array/, qsizetype len /ArraySize/);
%End
virtual bool open(QIODeviceBase::OpenMode openMode);
virtual void close();
virtual qint64 size() const;
virtual qint64 pos() const;
virtual bool seek(qint64 off);
virtual bool atEnd() const;
virtual bool canReadLine() const;
protected:
virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QBuffer::readData(s, a0) : sipCpp->readData(s, a0);
#else
len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipSelfWasArg ?
sipCpp->QBuffer::writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len) :
sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
#else
sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
#endif
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
};
@@ -0,0 +1,497 @@
// qbytearray.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qbytearray.h>
%End
class QByteArray /TypeHintIn="Union[QByteArray, bytes, bytearray, memoryview]"/
{
%TypeHeaderCode
#include <qbytearray.h>
%End
%TypeCode
// This is needed by __hash__().
#include <qhash.h>
// Convenience function for converting a QByteArray to a Python str object.
static PyObject *QByteArrayToPyStr(QByteArray *ba)
{
char *data = ba->data();
if (data)
// QByteArrays may have embedded '\0's so set the size explicitly.
return PyBytes_FromStringAndSize(data, ba->size());
return PyBytes_FromString("");
}
%End
%ConvertToTypeCode
// Accept anything that implements the buffer protocol (including QByteArray
// itself).
if (sipIsErr == NULL)
return sipGetBufferInfo(sipPy, NULL);
// If it is already a QByteArray then use it rather than make an unnecessary
// copy of the data.
if (sipCanConvertToType(sipPy, sipType_QByteArray, SIP_NO_CONVERTORS))
{
*sipCppPtr = reinterpret_cast<QByteArray *>(
sipConvertToType(sipPy, sipType_QByteArray, sipTransferObj,
SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
}
// Create a QByteArray from the data.
sipBufferInfoDef buffer_info;
if (sipGetBufferInfo(sipPy, &buffer_info) > 0)
{
// Check that the buffer is compatible with one defined by
// PyBuffer_FillInfo() as used by QByteArray and the standard Python byte
// objects.
if (buffer_info.bi_format == NULL || buffer_info.bi_format[0] == 'B')
{
*sipCppPtr = new QByteArray(
reinterpret_cast<const char *>(buffer_info.bi_buf),
(qsizetype)buffer_info.bi_len);
sipReleaseBufferInfo(&buffer_info);
// We don't support transfer of ownership.
return SIP_TEMPORARY;
}
PyErr_Format(PyExc_TypeError, "unsupported buffer format '%s'",
buffer_info.bi_format);
sipReleaseBufferInfo(&buffer_info);
}
*sipIsErr = 1;
return 0;
%End
%BIGetBufferCode
// We may be building against a debug Python build.
#if defined(Py_LIMITED_API)
Q_UNUSED(sipSelf);
sipBuffer->bd_buffer = sipCpp->data();
sipBuffer->bd_length = sipCpp->size();
sipBuffer->bd_readonly = 0;
sipRes = 0;
#else
sipRes = PyBuffer_FillInfo(sipBuffer, sipSelf, sipCpp->data(),
sipCpp->size(), 0, sipFlags);
#endif
%End
%PickleCode
sipRes = Py_BuildValue("(y#)", sipCpp->data(), static_cast<Py_ssize_t>(sipCpp->size()));
%End
public:
QByteArray();
QByteArray(qsizetype size, char c /Encoding="None"/);
QByteArray(const QByteArray &a);
~QByteArray();
void resize(qsizetype size);
%If (Qt_6_4_0 -)
void resize(qsizetype size, char c);
%End
QByteArray &fill(char c /Encoding="None"/, qsizetype size = -1);
void clear();
qsizetype indexOf(QByteArrayView bv, qsizetype from = 0) const;
// In Qt v6.2 this was replaced by two separate overloads. However we need to keep the optional keyword argument.
qsizetype lastIndexOf(QByteArrayView bv, qsizetype from = -1) const;
qsizetype count(QByteArrayView bv) const;
QByteArray left(qsizetype len) const;
QByteArray right(qsizetype len) const;
QByteArray mid(qsizetype index, qsizetype length = -1) const;
QByteArray first(qsizetype n) const;
QByteArray last(qsizetype n) const;
bool startsWith(QByteArrayView bv) const;
bool endsWith(QByteArrayView bv) const;
void truncate(qsizetype pos);
void chop(qsizetype n);
QByteArray toLower() const;
QByteArray toUpper() const;
QByteArray trimmed() const;
QByteArray simplified() const;
QByteArray leftJustified(qsizetype width, char fill /Encoding="None"/ = ' ', bool truncate = false) const;
QByteArray rightJustified(qsizetype width, char fill /Encoding="None"/ = ' ', bool truncate = false) const;
QByteArray &prepend(QByteArrayView a);
QByteArray &prepend(qsizetype count, char c /Encoding="None"/);
QByteArray &append(QByteArrayView a);
QByteArray &append(qsizetype count, char c /Encoding="None"/);
QByteArray &insert(qsizetype i, QByteArrayView data);
QByteArray &insert(qsizetype i, qsizetype count, char c /Encoding="None"/);
QByteArray &remove(qsizetype index, qsizetype len);
QByteArray &replace(QByteArrayView before, QByteArrayView after);
QByteArray &replace(qsizetype index, qsizetype len, QByteArrayView s);
QList<QByteArray> split(char sep /Encoding="None"/) const;
QByteArray &operator+=(QByteArrayView a);
bool operator==(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp == *a0);
%End
bool operator!=(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp != *a0);
%End
bool operator<(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp < *a0);
%End
bool operator>(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp > *a0);
%End
bool operator<=(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp <= *a0);
%End
bool operator>=(const QString &s2) const;
%MethodCode
// Needed for Qt v6.8 and later.
sipRes = (*sipCpp >= *a0);
%End
short toShort(bool *ok = 0, int base = 10) const;
ushort toUShort(bool *ok = 0, int base = 10) const;
int toInt(bool *ok = 0, int base = 10) const;
uint toUInt(bool *ok = 0, int base = 10) const;
long toLong(bool *ok = 0, int base = 10) const;
ulong toULong(bool *ok = 0, int base = 10) const;
qlonglong toLongLong(bool *ok = 0, int base = 10) const;
qulonglong toULongLong(bool *ok = 0, int base = 10) const;
float toFloat(bool *ok = 0) const;
double toDouble(bool *ok = 0) const;
QByteArray toBase64(QByteArray::Base64Options options = QByteArray::Base64Encoding) const;
QByteArray &setNum(double n /Constrained/, char format = 'g', int precision = 6);
QByteArray &setNum(SIP_PYOBJECT n /TypeHint="int"/, int base = 10);
%MethodCode
qlonglong val = sipLong_AsLongLong(a0);
if (!PyErr_Occurred())
{
sipRes = &sipCpp->setNum(val, a1);
}
else
{
// If it is positive then it might fit an unsigned long long.
qulonglong uval = sipLong_AsUnsignedLongLong(a0);
if (!PyErr_Occurred())
{
sipRes = &sipCpp->setNum(uval, a1);
}
else
{
sipError = (PyErr_ExceptionMatches(PyExc_OverflowError)
? sipErrorFail : sipErrorContinue);
}
}
%End
static QByteArray number(double n /Constrained/, char format = 'g', int precision = 6);
static QByteArray number(SIP_PYOBJECT n /TypeHint="int"/, int base = 10);
%MethodCode
qlonglong val = sipLong_AsLongLong(a0);
if (!PyErr_Occurred())
{
sipRes = new QByteArray(QByteArray::number(val, a1));
}
else
{
// If it is positive then it might fit an unsigned long long.
qulonglong uval = sipLong_AsUnsignedLongLong(a0);
if (!PyErr_Occurred())
{
sipRes = new QByteArray(QByteArray::number(uval, a1));
}
else
{
sipError = (PyErr_ExceptionMatches(PyExc_OverflowError)
? sipErrorFail : sipErrorContinue);
}
}
%End
static QByteArray fromBase64(const QByteArray &base64, QByteArray::Base64Options options = QByteArray::Base64Encoding);
static QByteArray fromHex(const QByteArray &hexEncoded);
qsizetype count() const;
qsizetype length() const;
bool isNull() const;
qsizetype size() const /__len__/;
char at(qsizetype i) const /Encoding="None"/;
char operator[](qsizetype i) const /Encoding="None"/;
%MethodCode
Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->size());
if (idx < 0)
sipIsErr = 1;
else
sipRes = sipCpp->operator[]((qsizetype)idx);
%End
QByteArray operator[](SIP_PYSLICE slice) const;
%MethodCode
Py_ssize_t start, stop, step, slicelength;
if (sipConvertFromSliceObject(a0, sipCpp->size(), &start, &stop, &step, &slicelength) < 0)
{
sipIsErr = 1;
}
else
{
sipRes = new QByteArray();
for (Py_ssize_t i = 0; i < slicelength; ++i)
{
sipRes->append(sipCpp->at((qsizetype)start));
start += step;
}
}
%End
int __contains__(const QByteArrayView bv) const;
%MethodCode
sipRes = sipCpp->contains(*a0);
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
SIP_PYOBJECT __str__() const /TypeHint="str"/;
%MethodCode
sipRes = QByteArrayToPyStr(sipCpp);
PyObject *repr = PyObject_Repr(sipRes);
if (repr)
{
Py_DECREF(sipRes);
sipRes = repr;
}
%End
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QByteArray()");
}
else
{
PyObject *str = QByteArrayToPyStr(sipCpp);
if (str)
{
sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QByteArray(%R)", str);
Py_DECREF(str);
}
}
%End
QByteArray operator*(int m) const;
%MethodCode
sipRes = new QByteArray();
while (a0-- > 0)
*sipRes += *sipCpp;
%End
QByteArray &operator*=(int m);
%MethodCode
QByteArray orig(*sipCpp);
sipCpp->clear();
while (a0-- > 0)
*sipCpp += orig;
%End
bool isEmpty() const;
SIP_PYOBJECT data() /TypeHint="bytes"/;
%MethodCode
// QByteArrays may contain embedded '\0's so set the size explicitly.
char *res = sipCpp->data();
qsizetype len = sipCpp->size();
if (res)
{
if ((sipRes = PyBytes_FromStringAndSize(res, (Py_ssize_t)len)) == NULL)
sipIsErr = 1;
}
else
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
%End
qsizetype capacity() const;
void reserve(qsizetype size);
void squeeze();
void push_back(QByteArrayView a);
void push_front(QByteArrayView a);
bool contains(QByteArrayView bv) const;
QByteArray toHex(char separator /Encoding="None"/ = '\x00') const;
QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(), const QByteArray &include = QByteArray(), char percent = '%') const;
static QByteArray fromPercentEncoding(const QByteArray &input, char percent = '%');
QByteArray repeated(qsizetype times) const;
void swap(QByteArray &other /Constrained/);
enum Base64Option /BaseType=Flag/
{
Base64Encoding,
Base64UrlEncoding,
KeepTrailingEquals,
OmitTrailingEquals,
IgnoreBase64DecodingErrors,
AbortOnBase64DecodingErrors,
};
typedef QFlags<QByteArray::Base64Option> Base64Options;
QByteArray chopped(qsizetype len) const;
int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool isUpper() const;
bool isLower() const;
enum class Base64DecodingStatus
{
Ok,
IllegalInputLength,
IllegalCharacter,
IllegalPadding,
};
static QByteArray::FromBase64Result fromBase64Encoding(const QByteArray &base64, QByteArray::Base64Options options = QByteArray::Base64Encoding);
class FromBase64Result
{
%TypeHeaderCode
#include <qbytearray.h>
%End
public:
QByteArray decoded;
QByteArray::Base64DecodingStatus decodingStatus;
void swap(QByteArray::FromBase64Result &other /Constrained/);
operator bool() const;
%MethodCode
// This is required because SIP doesn't handle operator bool() properly.
sipRes = sipCpp->operator bool();
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
QByteArray sliced(qsizetype pos) const;
QByteArray sliced(qsizetype pos, qsizetype n) const;
%If (Qt_6_3_0 -)
bool isValidUtf8() const;
%End
%If (Qt_6_4_0 -)
QByteArray percentDecoded(char percent = '%') const;
%End
%If (Qt_6_5_0 -)
QByteArray &removeAt(qsizetype pos);
%End
%If (Qt_6_5_0 -)
QByteArray &removeFirst();
%End
%If (Qt_6_5_0 -)
QByteArray &removeLast();
%End
%If (Qt_6_6_0 -)
QByteArray &assign(QByteArrayView v);
%End
%If (Qt_6_8_0 -)
QByteArray &slice(qsizetype pos, qsizetype n);
%End
%If (Qt_6_8_0 -)
QByteArray &slice(qsizetype pos);
%End
%If (Qt_6_8_0 -)
qsizetype max_size() const;
%End
%If (Qt_6_8_0 -)
static qsizetype maxSize();
%End
};
bool operator==(const QByteArray &a1, const QByteArray &a2);
bool operator!=(const QByteArray &a1, const QByteArray &a2);
bool operator<(const QByteArray &a1, const QByteArray &a2);
bool operator<=(const QByteArray &a1, const QByteArray &a2);
bool operator>(const QByteArray &a1, const QByteArray &a2);
bool operator>=(const QByteArray &a1, const QByteArray &a2);
%If (Qt_6_5_0 -)
QByteArray operator+(const QByteArray &a1, const QByteArray &a2);
%End
%If (- Qt_6_5_0)
const QByteArray operator+(const QByteArray &a1, const QByteArray &a2);
%End
QDataStream &operator<<(QDataStream &, const QByteArray & /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QByteArray & /Constrained/) /ReleaseGIL/;
QByteArray qCompress(const uchar *data /Array/, qsizetype nbytes /ArraySize/, int compressionLevel = -1);
QByteArray qCompress(const QByteArray &data, int compressionLevel = -1);
QByteArray qUncompress(const uchar *data /Array/, qsizetype nbytes /ArraySize/);
QByteArray qUncompress(const QByteArray &data);
%If (- Qt_6_2_0)
quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard = Qt::ChecksumIso3309);
%End
bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs);
bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs);
@@ -0,0 +1,31 @@
// qbytearrayalgorithms.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_2_0 -)
%ModuleCode
#include <qbytearrayalgorithms.h>
%End
%End
%If (Qt_6_2_0 -)
quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard = Qt::ChecksumIso3309);
%End
@@ -0,0 +1,124 @@
// This is the SIP interface definition for the QByteArrayList mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%MappedType QByteArrayList
/TypeHintIn="Iterable[QByteArray]", TypeHintOut="List[QByteArray]",
TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qstringlist.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
QByteArray *t = new QByteArray(sipCpp->at(i));
PyObject *tobj = sipConvertFromNewType(t, sipType_QByteArray,
sipTransferObj);
if (!tobj)
{
delete t;
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, tobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QByteArrayList *ql = new QByteArrayList;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int state;
QByteArray *t = reinterpret_cast<QByteArray *>(
sipForceConvertToType(itm, sipType_QByteArray, sipTransferObj,
SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'str' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QByteArray, state);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
@@ -0,0 +1,56 @@
// qbytearraymatcher.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QByteArrayMatcher
{
%TypeHeaderCode
#include <qbytearraymatcher.h>
%End
public:
%If (Qt_6_3_0 -)
QByteArrayMatcher(const char *pattern /Encoding="None"/, qsizetype length = -1);
%End
%If (- Qt_6_3_0)
QByteArrayMatcher(const char *pattern /Encoding="None"/, qsizetype length);
%End
%If (Qt_6_3_0 -)
explicit QByteArrayMatcher(QByteArrayView pattern);
%End
%If (- Qt_6_3_0)
%If (Qt_6_4_0 -)
explicit QByteArrayMatcher(const QByteArray &pattern);
%End
%End
QByteArrayMatcher();
QByteArrayMatcher(const QByteArrayMatcher &other);
~QByteArrayMatcher();
void setPattern(const QByteArray &pattern);
%If (Qt_6_3_0 -)
qsizetype indexIn(QByteArrayView data, qsizetype from = 0) const;
%End
%If (- Qt_6_3_0)
qsizetype indexIn(const QByteArray &ba, qsizetype from = 0) const;
%End
qsizetype indexIn(const char *str /Encoding="None"/, qsizetype len, qsizetype from = 0) const;
QByteArray pattern() const;
};
@@ -0,0 +1,67 @@
// This is the SIP interface definition for the QByteArrayView mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%MappedType QByteArrayView /TypeHint="QByteArray"/
{
%TypeHeaderCode
#include <qbytearrayview.h>
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
{
// Note that we choose to use QByteArray's implementation of the buffer
// protocol.
return sipGetBufferInfo(sipPy, NULL);
}
sipBufferInfoDef *buffer_info = (sipBufferInfoDef *)sipMalloc(
sizeof (sipBufferInfoDef));
if (buffer_info)
{
if (sipGetBufferInfo(sipPy, buffer_info) > 0)
{
*sipCppPtr = new QByteArrayView(
reinterpret_cast<const unsigned char *>(buffer_info->bi_buf),
(qsizetype)buffer_info->bi_len);
*sipUserStatePtr = buffer_info;
// We don't support transfer of ownership.
return SIP_TEMPORARY;
}
sipFree(buffer_info);
}
*sipIsErr = 1;
return 0;
%End
%ReleaseCode
delete sipCpp;
sipBufferInfoDef *buffer_info = reinterpret_cast<sipBufferInfoDef *>(sipUserState);
sipReleaseBufferInfo(buffer_info);
sipFree(buffer_info);
%End
};
@@ -0,0 +1,99 @@
// qcalendar.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCalendar
{
%TypeHeaderCode
#include <qcalendar.h>
%End
public:
enum
{
Unspecified,
};
struct YearMonthDay
{
%TypeHeaderCode
#include <qcalendar.h>
%End
YearMonthDay();
YearMonthDay(int year, int month = 1, int day = 1);
bool isValid() const;
int year;
int month;
int day;
};
enum class System
{
Gregorian,
Julian,
Milankovic,
Jalali,
IslamicCivil,
};
QCalendar();
explicit QCalendar(QCalendar::System system);
%If (Qt_6_4_0 -)
explicit QCalendar(QAnyStringView name);
%End
%If (- Qt_6_4_0)
explicit QCalendar(const char *name /Encoding="Latin-1"/) [(QLatin1String name)];
%MethodCode
// This is currently the only occurence of a QLatin1String argument.
sipCpp = new QCalendar(QLatin1String(a0));
%End
%End
int daysInMonth(int month, int year = QCalendar::Unspecified) const;
int daysInYear(int year) const;
int monthsInYear(int year) const;
bool isDateValid(int year, int month, int day) const;
bool isLeapYear(int year) const;
bool isGregorian() const;
bool isLunar() const;
bool isLuniSolar() const;
bool isSolar() const;
bool isProleptic() const;
bool hasYearZero() const;
int maximumDaysInMonth() const;
int minimumDaysInMonth() const;
int maximumMonthsInYear() const;
QString name() const;
QDate dateFromParts(int year, int month, int day) const;
QDate dateFromParts(const QCalendar::YearMonthDay &parts) const;
QCalendar::YearMonthDay partsFromDate(QDate date) const;
int dayOfWeek(QDate date) const;
QString monthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const;
QString standaloneMonthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const;
QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const;
QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const;
QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const;
static QStringList availableCalendars();
%If (Qt_6_7_0 -)
QDate matchCenturyToWeekday(const QCalendar::YearMonthDay &parts, int dow) const;
%End
};
@@ -0,0 +1,99 @@
// qcborcommon.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qcborcommon.h>
%End
// // Handwritten implementation of QCborSimpleType.
// Cast-XML has a bug which means that it places this definition in qmetatype.h
// (where it is first declared).
enum class QCborSimpleType {
False /PyName=False_/,
True /PyName=True_/,
Null,
Undefined
};
struct QCborError
{
%TypeHeaderCode
#include <qcborcommon.h>
%End
enum Code
{
UnknownError,
AdvancePastEnd,
InputOutputError,
GarbageAtEnd,
EndOfFile,
UnexpectedBreak,
UnknownType,
IllegalType,
IllegalNumber,
IllegalSimpleType,
InvalidUtf8String,
DataTooLarge,
NestingTooDeep,
UnsupportedType,
NoError,
};
// Error code access
// This class is currently undocumented. Access to the error code is via a
// cast (which SIP doesn't support) or a badly named instance variable. To be
// safe we implement a more Qt-typical solution.
QCborError::Code code() const;
%MethodCode
sipRes = sipCpp->c;
%End
QString toString() const;
};
enum class QCborKnownTags
{
DateTimeString,
UnixTime_t,
PositiveBignum,
NegativeBignum,
Decimal,
Bigfloat,
COSE_Encrypt0,
COSE_Mac0,
COSE_Sign1,
ExpectedBase64url,
ExpectedBase64,
ExpectedBase16,
EncodedCbor,
Url,
Base64url,
Base64,
RegularExpression,
MimeMessage,
Uuid,
COSE_Encrypt,
COSE_Mac,
COSE_Sign,
Signature,
};
@@ -0,0 +1,164 @@
// qcborstreamreader.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCborStreamReader
{
%TypeHeaderCode
#include <qcborstreamreader.h>
%End
public:
enum Type
{
UnsignedInteger,
NegativeInteger,
ByteString,
ByteArray,
TextString,
String,
Array,
Map,
Tag,
SimpleType,
HalfFloat,
Float16,
Float,
Double,
Invalid,
};
enum StringResultCode
{
EndOfString,
Ok,
Error,
};
QCborStreamReader();
explicit QCborStreamReader(const QByteArray &data);
explicit QCborStreamReader(QIODevice *device);
~QCborStreamReader();
void setDevice(QIODevice *device);
QIODevice *device() const;
void addData(const QByteArray &data);
void reparse();
void clear();
void reset();
%If (Qt_6_7_0 -)
QCborError lastError() const;
%End
%If (- Qt_6_7_0)
QCborError lastError();
%End
qint64 currentOffset() const;
bool isValid() const;
int containerDepth() const;
QCborStreamReader::Type parentContainerType() const;
bool hasNext() const;
bool next(int maxRecursion = 10000);
QCborStreamReader::Type type() const;
bool isUnsignedInteger() const;
bool isNegativeInteger() const;
bool isInteger() const;
bool isByteArray() const;
bool isString() const;
bool isArray() const;
bool isMap() const;
bool isTag() const;
bool isSimpleType() const;
bool isFloat16() const;
bool isFloat() const;
bool isDouble() const;
bool isInvalid() const;
bool isSimpleType(QCborSimpleType st) const;
bool isFalse() const;
bool isTrue() const;
bool isBool() const;
bool isNull() const;
bool isUndefined() const;
bool isLengthKnown() const;
quint64 length() const /__len__/;
bool isContainer() const;
bool enterContainer();
bool leaveContainer();
SIP_PYTUPLE readString() /TypeHint="Tuple[str, QCborStreamReader.StringResultCode]"/;
%MethodCode
QCborStreamReader::StringResult<QString> res = sipCpp->readString();
QString *qs = new QString;
if (res.status != QCborStreamReader::Error)
*qs = res.data;
sipRes = sipBuildResult(NULL, "NF", qs, sipType_QString, NULL, res.status, sipType_QCborStreamReader_StringResultCode);
%End
SIP_PYTUPLE readByteArray() /TypeHint="Tuple[QByteArray, QCborStreamReader.StringResultCode]"/;
%MethodCode
QCborStreamReader::StringResult<QByteArray> res = sipCpp->readByteArray();
QByteArray *qba = new QByteArray;
if (res.status != QCborStreamReader::Error)
*qba = res.data;
sipRes = sipBuildResult(NULL, "NF", qba, sipType_QByteArray, NULL, res.status, sipType_QCborStreamReader_StringResultCode);
%End
%If (Qt_6_7_0 -)
SIP_PYTUPLE readUtf8String() /TypeHint="Tuple[QByteArray, QCborStreamReader.StringResultCode]"/;
%MethodCode
QCborStreamReader::StringResult<QByteArray> res = sipCpp->readUtf8String();
QByteArray *qba = new QByteArray;
if (res.status != QCborStreamReader::Error)
*qba = res.data;
sipRes = sipBuildResult(NULL, "NF", qba, sipType_QByteArray, NULL, res.status, sipType_QCborStreamReader_StringResultCode);
%End
%End
bool toBool() const;
quint64 toUnsignedInteger() const;
QCborSimpleType toSimpleType() const;
double toDouble() const;
qint64 toInteger() const;
%If (Qt_6_7_0 -)
bool readAndAppendToString(QString &dst);
%End
%If (Qt_6_7_0 -)
bool readAndAppendToUtf8String(QByteArray &dst);
%End
%If (Qt_6_7_0 -)
bool readAndAppendToByteArray(QByteArray &dst);
%End
%If (Qt_6_7_0 -)
QString readAllString();
%End
%If (Qt_6_7_0 -)
QByteArray readAllUtf8String();
%End
%If (Qt_6_7_0 -)
QByteArray readAllByteArray();
%End
private:
QCborStreamReader(const QCborStreamReader &);
};
@@ -0,0 +1,81 @@
// qcborstreamwriter.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCborStreamWriter
{
%TypeHeaderCode
#include <qcborstreamwriter.h>
%End
public:
explicit QCborStreamWriter(QIODevice *device);
explicit QCborStreamWriter(QByteArray *data /Constrained/);
~QCborStreamWriter();
void setDevice(QIODevice *device);
QIODevice *device() const;
void append(const QByteArray &ba);
void append(QStringView str);
void append(QCborKnownTags tag);
void append(QCborSimpleType st);
void append(bool b /Constrained/);
void append(double d /Constrained/);
void append(SIP_PYOBJECT /TypeHint="int"/);
%MethodCode
static PyObject *zero = 0;
if (!zero)
zero = PyLong_FromLong(0);
if (PyObject_RichCompareBool(a0, zero, Py_LT) > 0)
{
PyErr_Clear();
qint64 val = sipLong_AsLongLong(a0);
if (PyErr_Occurred())
sipError = sipErrorFail;
else
sipCpp->append(val);
}
else
{
PyErr_Clear();
quint64 val = sipLong_AsUnsignedLongLong(a0);
if (PyErr_Occurred())
sipError = sipErrorFail;
else
sipCpp->append(val);
}
%End
void appendNull();
void appendUndefined();
void startArray();
void startArray(quint64 count);
bool endArray();
void startMap();
void startMap(quint64 count);
bool endMap();
private:
QCborStreamWriter(const QCborStreamWriter &);
};
@@ -0,0 +1,231 @@
// qchar.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QChar /TypeHint="str"/
{
%TypeHeaderCode
#include <qchar.h>
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
return PyUnicode_Check(sipPy);
// TODO: review replacing with something more efficient.
QString qs = qpycore_PyObject_AsQString(sipPy);
if (qs.size() != 1)
{
PyErr_SetString(PyExc_ValueError, "string of length 1 expected");
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new QChar(qs.at(0));
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
// TODO: replace with...
// return PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, sipCpp, 1);
return qpycore_PyObject_FromQString(QString(*sipCpp));
%End
public:
enum Script
{
Script_Unknown,
Script_Inherited,
Script_Common,
Script_Latin,
Script_Greek,
Script_Cyrillic,
Script_Armenian,
Script_Hebrew,
Script_Arabic,
Script_Syriac,
Script_Thaana,
Script_Devanagari,
Script_Bengali,
Script_Gurmukhi,
Script_Gujarati,
Script_Oriya,
Script_Tamil,
Script_Telugu,
Script_Kannada,
Script_Malayalam,
Script_Sinhala,
Script_Thai,
Script_Lao,
Script_Tibetan,
Script_Myanmar,
Script_Georgian,
Script_Hangul,
Script_Ethiopic,
Script_Cherokee,
Script_CanadianAboriginal,
Script_Ogham,
Script_Runic,
Script_Khmer,
Script_Mongolian,
Script_Hiragana,
Script_Katakana,
Script_Bopomofo,
Script_Han,
Script_Yi,
Script_OldItalic,
Script_Gothic,
Script_Deseret,
Script_Tagalog,
Script_Hanunoo,
Script_Buhid,
Script_Tagbanwa,
Script_Coptic,
Script_Limbu,
Script_TaiLe,
Script_LinearB,
Script_Ugaritic,
Script_Shavian,
Script_Osmanya,
Script_Cypriot,
Script_Braille,
Script_Buginese,
Script_NewTaiLue,
Script_Glagolitic,
Script_Tifinagh,
Script_SylotiNagri,
Script_OldPersian,
Script_Kharoshthi,
Script_Balinese,
Script_Cuneiform,
Script_Phoenician,
Script_PhagsPa,
Script_Nko,
Script_Sundanese,
Script_Lepcha,
Script_OlChiki,
Script_Vai,
Script_Saurashtra,
Script_KayahLi,
Script_Rejang,
Script_Lycian,
Script_Carian,
Script_Lydian,
Script_Cham,
Script_TaiTham,
Script_TaiViet,
Script_Avestan,
Script_EgyptianHieroglyphs,
Script_Samaritan,
Script_Lisu,
Script_Bamum,
Script_Javanese,
Script_MeeteiMayek,
Script_ImperialAramaic,
Script_OldSouthArabian,
Script_InscriptionalParthian,
Script_InscriptionalPahlavi,
Script_OldTurkic,
Script_Kaithi,
Script_Batak,
Script_Brahmi,
Script_Mandaic,
Script_Chakma,
Script_MeroiticCursive,
Script_MeroiticHieroglyphs,
Script_Miao,
Script_Sharada,
Script_SoraSompeng,
Script_Takri,
Script_CaucasianAlbanian,
Script_BassaVah,
Script_Duployan,
Script_Elbasan,
Script_Grantha,
Script_PahawhHmong,
Script_Khojki,
Script_LinearA,
Script_Mahajani,
Script_Manichaean,
Script_MendeKikakui,
Script_Modi,
Script_Mro,
Script_OldNorthArabian,
Script_Nabataean,
Script_Palmyrene,
Script_PauCinHau,
Script_OldPermic,
Script_PsalterPahlavi,
Script_Siddham,
Script_Khudawadi,
Script_Tirhuta,
Script_WarangCiti,
Script_Ahom,
Script_AnatolianHieroglyphs,
Script_Hatran,
Script_Multani,
Script_OldHungarian,
Script_SignWriting,
Script_Adlam,
Script_Bhaiksuki,
Script_Marchen,
Script_Newa,
Script_Osage,
Script_Tangut,
Script_MasaramGondi,
Script_Nushu,
Script_Soyombo,
Script_ZanabazarSquare,
Script_Dogra,
Script_GunjalaGondi,
Script_HanifiRohingya,
Script_Makasar,
Script_Medefaidrin,
Script_OldSogdian,
Script_Sogdian,
Script_Elymaic,
Script_Nandinagari,
Script_NyiakengPuachueHmong,
Script_Wancho,
Script_Chorasmian,
Script_DivesAkuru,
Script_KhitanSmallScript,
Script_Yezidi,
Script_CyproMinoan,
Script_OldUyghur,
Script_Tangsa,
Script_Toto,
Script_Vithkuqi,
Script_Kawi,
Script_NagMundari,
};
};
bool operator>=(const QChar &lhs, const QChar &rhs);
bool operator<=(const QChar &lhs, const QChar &rhs);
bool operator>(const QChar &lhs, const QChar &rhs);
bool operator<(const QChar &lhs, const QChar &rhs);
bool operator!=(const QChar &lhs, const QChar &rhs);
bool operator==(const QChar &lhs, const QChar &rhs);
QDataStream &operator<<(QDataStream &, QChar) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QChar & /Constrained/) /ReleaseGIL/;
@@ -0,0 +1,69 @@
// qcollator.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCollatorSortKey
{
%TypeHeaderCode
#include <qcollator.h>
%End
public:
QCollatorSortKey(const QCollatorSortKey &other);
~QCollatorSortKey();
void swap(QCollatorSortKey &other /Constrained/);
int compare(const QCollatorSortKey &key) const;
private:
QCollatorSortKey();
};
bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs);
class QCollator
{
%TypeHeaderCode
#include <qcollator.h>
%End
public:
QCollator();
explicit QCollator(const QLocale &locale);
QCollator(const QCollator &);
~QCollator();
void swap(QCollator &other /Constrained/);
void setLocale(const QLocale &locale);
QLocale locale() const;
Qt::CaseSensitivity caseSensitivity() const;
void setCaseSensitivity(Qt::CaseSensitivity cs);
void setNumericMode(bool on);
bool numericMode() const;
void setIgnorePunctuation(bool on);
bool ignorePunctuation() const;
int compare(const QString &s1, const QString &s2) const;
QCollatorSortKey sortKey(const QString &string) const;
%If (Qt_6_3_0 -)
static int defaultCompare(QStringView s1, QStringView s2);
%End
%If (Qt_6_3_0 -)
static QCollatorSortKey defaultSortKey(QStringView key);
%End
};
@@ -0,0 +1,55 @@
// qcommandlineoption.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCommandLineOption
{
%TypeHeaderCode
#include <qcommandlineoption.h>
%End
public:
explicit QCommandLineOption(const QString &name);
explicit QCommandLineOption(const QStringList &names);
QCommandLineOption(const QString &name, const QString &description, const QString &valueName = QString(), const QString &defaultValue = QString());
QCommandLineOption(const QStringList &names, const QString &description, const QString &valueName = QString(), const QString &defaultValue = QString());
QCommandLineOption(const QCommandLineOption &other);
~QCommandLineOption();
void swap(QCommandLineOption &other /Constrained/);
QStringList names() const;
void setValueName(const QString &name);
QString valueName() const;
void setDescription(const QString &description);
QString description() const;
void setDefaultValue(const QString &defaultValue);
void setDefaultValues(const QStringList &defaultValues);
QStringList defaultValues() const;
enum Flag /BaseType=Flag/
{
HiddenFromHelp,
ShortOptionStyle,
};
typedef QFlags<QCommandLineOption::Flag> Flags;
QCommandLineOption::Flags flags() const;
void setFlags(QCommandLineOption::Flags aflags);
};
@@ -0,0 +1,75 @@
// qcommandlineparser.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCommandLineParser
{
%TypeHeaderCode
#include <qcommandlineparser.h>
%End
public:
QCommandLineParser();
~QCommandLineParser();
enum SingleDashWordOptionMode
{
ParseAsCompactedShortOptions,
ParseAsLongOptions,
};
void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode parsingMode);
bool addOption(const QCommandLineOption &commandLineOption);
QCommandLineOption addVersionOption();
QCommandLineOption addHelpOption();
void setApplicationDescription(const QString &description);
QString applicationDescription() const;
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString());
void clearPositionalArguments();
void process(const QStringList &arguments) /ReleaseGIL/;
void process(const QCoreApplication &app) /ReleaseGIL/;
bool parse(const QStringList &arguments);
QString errorText() const;
bool isSet(const QString &name) const;
QString value(const QString &name) const;
QStringList values(const QString &name) const;
bool isSet(const QCommandLineOption &option) const;
QString value(const QCommandLineOption &option) const;
QStringList values(const QCommandLineOption &option) const;
QStringList positionalArguments() const;
QStringList optionNames() const;
QStringList unknownOptionNames() const;
void showHelp(int exitCode = 0) /ReleaseGIL/;
QString helpText() const;
bool addOptions(const QList<QCommandLineOption> &options);
void showVersion();
enum OptionsAfterPositionalArgumentsMode
{
ParseAsOptions,
ParseAsPositionalArguments,
};
void setOptionsAfterPositionalArgumentsMode(QCommandLineParser::OptionsAfterPositionalArgumentsMode mode);
private:
QCommandLineParser(const QCommandLineParser &);
};
@@ -0,0 +1,90 @@
// qconcatenatetablesproxymodel.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QConcatenateTablesProxyModel : public QAbstractItemModel
{
%TypeHeaderCode
#include <qconcatenatetablesproxymodel.h>
%End
public:
explicit QConcatenateTablesProxyModel(QObject *parent /TransferThis/ = 0);
virtual ~QConcatenateTablesProxyModel();
void addSourceModel(QAbstractItemModel *sourceModel /GetWrapper/);
%MethodCode
// We want to keep a reference to the model but this is in addition to the
// existing ones and does not replace them - so we can't use /KeepReference/.
sipCpp->addSourceModel(a0);
// Use the user object as a list of the references.
PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
if (!user)
{
user = PyList_New(0);
sipSetUserObject((sipSimpleWrapper *)sipSelf, user);
}
if (user)
PyList_Append(user, a0Wrapper);
%End
void removeSourceModel(QAbstractItemModel *sourceModel /GetWrapper/);
%MethodCode
// Discard the extra model reference that we took in addSourceModel().
sipCpp->removeSourceModel(a0);
// Use the user object as a list of the references.
PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
if (user)
{
Py_ssize_t i = 0;
// Note that we deal with an object appearing in the list more than once.
while (i < PyList_Size(user))
if (PyList_GetItem(user, i) == a0Wrapper)
PyList_SetSlice(user, i, i + 1, NULL);
else
++i;
}
%End
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
virtual QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const;
virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex parent(const QModelIndex &index) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/;
virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual QSize span(const QModelIndex &index) const;
QList<QAbstractItemModel *> sourceModels() const;
};
@@ -0,0 +1,410 @@
// qcoreapplication.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qcoreapplication.h>
%End
class QCoreApplication : public QObject
{
%TypeHeaderCode
#include <qcoreapplication.h>
%End
public:
QCoreApplication(SIP_PYLIST argv /TypeHint="List[str]"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, int = QCoreApplication::ApplicationFlags)];
%MethodCode
// The Python interface is a list of argument strings that is modified.
int argc;
char **argv;
// Convert the list.
if ((argv = pyqt6_from_argv_list(a0, argc)) == NULL)
sipIsErr = 1;
else
{
// Create it now the arguments are right.
static int nargc;
nargc = argc;
Py_BEGIN_ALLOW_THREADS
sipCpp = new sipQCoreApplication(nargc, argv, QT_VERSION);
Py_END_ALLOW_THREADS
// Now modify the original list.
pyqt6_update_argv_list(a0, argc, argv);
}
%End
virtual ~QCoreApplication() /ReleaseGIL/;
%MethodCode
pyqt6_cleanup_qobjects();
%End
static void setOrganizationDomain(const QString &orgDomain);
static QString organizationDomain();
static void setOrganizationName(const QString &orgName);
static QString organizationName();
static void setApplicationName(const QString &application);
static QString applicationName();
static QStringList arguments();
static QCoreApplication *instance();
static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /ReleaseGIL/;
static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime) /ReleaseGIL/;
%If (Qt_6_7_0 -)
static void processEvents(QEventLoop::ProcessEventsFlags flags, QDeadlineTimer deadline) /ReleaseGIL/;
%End
static bool sendEvent(QObject *receiver, QEvent *event) /ReleaseGIL/;
static void postEvent(QObject *receiver, QEvent *event /Transfer/, int priority = Qt::NormalEventPriority);
static void sendPostedEvents(QObject *receiver = 0, int eventType = 0) /ReleaseGIL/;
static void removePostedEvents(QObject *receiver, int eventType = 0);
virtual bool notify(QObject *, QEvent *) /ReleaseGIL/;
static bool startingUp();
static bool closingDown();
static QString applicationDirPath();
static QString applicationFilePath();
static void setLibraryPaths(const QStringList &);
static QStringList libraryPaths();
static void addLibraryPath(const QString &);
static void removeLibraryPath(const QString &);
static bool installTranslator(QTranslator *messageFile);
static bool removeTranslator(QTranslator *messageFile);
static QString translate(const char *context, const char *sourceText /Encoding="UTF-8"/, const char *disambiguation = 0, int n = -1);
static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true);
static bool testAttribute(Qt::ApplicationAttribute attribute);
public slots:
static void quit();
%If (Qt_6_1_0 -)
static void exit(int returnCode = 0);
%End
public:
%If (- Qt_6_1_0)
static void exit(int returnCode = 0);
%End
signals:
void aboutToQuit();
protected:
virtual bool event(QEvent *);
public:
static void setApplicationVersion(const QString &version);
static QString applicationVersion();
static qint64 applicationPid();
static QAbstractEventDispatcher *eventDispatcher();
static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher /Transfer/);
static bool isQuitLockEnabled();
static void setQuitLockEnabled(bool enabled);
void installNativeEventFilter(QAbstractNativeEventFilter *filterObj);
void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj);
static void setSetuidAllowed(bool allow);
static bool isSetuidAllowed();
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
// Make sure the QCoreApplication is destroyed.
delete sipCpp;
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
Qt::PermissionStatus checkPermission(const QPermission &permission);
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
void requestPermission(const QPermission &permission, SIP_PYCALLABLE handler /TypeHint="Callable[[QPermission], None]"/) /ReleaseGIL/;
%MethodCode
// Make sure the callable doesn't get garbage collected until it is invoked.
Py_INCREF(a1);
Py_BEGIN_ALLOW_THREADS
sipCpp->requestPermission(*a0, [a1](const QPermission &arg0) {
SIP_BLOCK_THREADS
PyObject *res;
res = sipCallMethod(NULL, a1, "N", new QPermission(arg0), sipType_QPermission, NULL);
Py_DECREF(a1);
if (!res)
pyqt6_err_print();
else
Py_DECREF(res);
SIP_UNBLOCK_THREADS
});
Py_END_ALLOW_THREADS
%End
%End
%End
};
void qAddPostRoutine(SIP_PYCALLABLE);
%MethodCode
// Add it to the list of post routines if it already exists.
if (qtcore_PostRoutines != NULL)
{
// See if there is an empty slot.
bool app = true;
for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i)
if (PyList_GetItem(qtcore_PostRoutines, i) == Py_None)
{
Py_INCREF(a0);
PyList_SetItem(qtcore_PostRoutines, i, a0);
app = false;
break;
}
if (app && PyList_Append(qtcore_PostRoutines, a0) < 0)
sipIsErr = 1;
}
else if ((qtcore_PostRoutines = PyList_New(1)) != NULL)
{
Py_INCREF(a0);
PyList_SetItem(qtcore_PostRoutines, 0, a0);
qAddPostRoutine(qtcore_CallPostRoutines);
}
else
{
sipIsErr = 1;
}
%End
void qRemovePostRoutine(SIP_PYCALLABLE);
%MethodCode
// Remove it from the list of post routines if it exists.
if (qtcore_PostRoutines != NULL)
for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i)
if (PyList_GetItem(qtcore_PostRoutines, i) == a0)
{
Py_INCREF(Py_None);
PyList_SetItem(qtcore_PostRoutines, i, Py_None);
break;
}
%End
void qAddPreRoutine(SIP_PYCALLABLE routine /TypeHint="Callable[[], None]"/);
%MethodCode
// Add it to the list of pre routines if it already exists.
if (qtcore_PreRoutines != NULL)
{
if (PyList_Append(qtcore_PreRoutines, a0) < 0)
sipIsErr = 1;
}
else if ((qtcore_PreRoutines = PyList_New(1)) != NULL)
{
Py_INCREF(a0);
PyList_SetItem(qtcore_PreRoutines, 0, a0);
qAddPreRoutine(qtcore_CallPreRoutines);
}
else
{
sipIsErr = 1;
}
%End
// Module code needed by qAddPreRoutine, qAddPostRoutine() and qRemovePostRoutine().
%ModuleCode
// The list of Python pre routines.
static PyObject *qtcore_PreRoutines = NULL;
// Call all of the registered Python pre routines.
static void qtcore_CallPreRoutines()
{
for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PreRoutines); ++i)
{
PyObject *pr = PyList_GetItem(qtcore_PreRoutines, i);
if (pr != Py_None)
{
PyObject *res = PyObject_CallObject(pr, NULL);
Py_XDECREF(res);
}
}
}
// The list of Python post routines.
static PyObject *qtcore_PostRoutines = NULL;
// Call all of the registered Python post routines.
static void qtcore_CallPostRoutines()
{
for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i)
{
PyObject *pr = PyList_GetItem(qtcore_PostRoutines, i);
if (pr != Py_None)
{
PyObject *res = PyObject_CallObject(pr, NULL);
Py_XDECREF(res);
}
}
}
%End
void pyqtRemoveInputHook();
%MethodCode
// Clear the Python input hook installed when the module was initialised.
PyOS_InputHook = 0;
%End
void pyqtRestoreInputHook();
%MethodCode
// Restore the input hook.
PyOS_InputHook = qtcore_input_hook;
%End
%ModuleCode
#include <QCoreApplication>
#include <QEventLoop>
#include <QThread>
#if defined(Q_OS_WIN)
#include <conio.h>
#include <QTimer>
#else
#include <QSocketNotifier>
#endif
// This is the input hook that will process events while the interpreter is
// waiting for interactive input.
extern "C" {static int qtcore_input_hook();}
static int qtcore_input_hook()
{
QCoreApplication *app = QCoreApplication::instance();
if (app && app->thread() == QThread::currentThread())
{
QEventLoop loop;
#if defined(Q_OS_WIN)
QTimer timer;
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
while (!_kbhit())
{
// The delay is based on feedback from users.
timer.start(35);
loop.exec();
timer.stop();
}
QObject::disconnect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
#else
QSocketNotifier notifier(0, QSocketNotifier::Read, 0);
QObject::connect(&notifier, SIGNAL(activated(int)), &loop, SLOT(quit()));
loop.exec();
QObject::disconnect(&notifier, SIGNAL(activated(int)), &loop, SLOT(quit()));
#endif
}
return 0;
}
%End
%PostInitialisationCode
// Process events from the input hook.
PyOS_InputHook = qtcore_input_hook;
%End
%ExportedTypeHintCode
# Support for QDate, QDateTime and QTime.
import datetime
# Convenient type aliases.
PYQT_SIGNAL = typing.Union[QtCore.pyqtSignal, QtCore.pyqtBoundSignal]
PYQT_SLOT = typing.Union[collections.abc.Callable[..., Any], QtCore.pyqtBoundSignal]
%End
%TypeHintCode
# Support for QDate, QDateTime and QTime.
import datetime
# Support for new-style signals and slots.
class pyqtSignal:
signatures = ... # type: tuple[str, ...]
def __init__(self, *types: typing.Any, name: str = ...) -> None: ...
@typing.overload
def __get__(self, instance: None, owner: type['QObject']) -> 'pyqtSignal': ...
@typing.overload
def __get__(self, instance: 'QObject', owner: type['QObject']) -> 'pyqtBoundSignal': ...
class pyqtBoundSignal:
signal = ... # type: str
def __getitem__(self, key: object) -> 'pyqtBoundSignal': ...
def connect(self, slot: 'PYQT_SLOT') -> 'QMetaObject.Connection': ...
@typing.overload
def disconnect(self) -> None: ...
@typing.overload
def disconnect(self, slot: typing.Union['PYQT_SLOT', 'QMetaObject.Connection']) -> None: ...
def emit(self, *args: typing.Any) -> None: ...
FuncT = typing.TypeVar('FuncT', bound=collections.abc.Callable)
def pyqtSlot(*types, name: typing.Optional[str] = ..., result: typing.Optional[str] = ...) -> collections.abc.Callable[[FuncT], FuncT]: ...
# For QObject.findChild() and QObject.findChildren().
QObjectT = typing.TypeVar('QObjectT', bound=QObject)
# Convenient type aliases.
PYQT_SIGNAL = typing.Union[pyqtSignal, pyqtBoundSignal]
PYQT_SLOT = typing.Union[collections.abc.Callable[..., Any], pyqtBoundSignal]
%End
@@ -0,0 +1,300 @@
// qcoreevent.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QEvent /NoDefaultCtors,Supertype=PyQt6.sip.wrapper/
{
%TypeHeaderCode
#include <qcoreevent.h>
%End
%ConvertToSubClassCode
switch (sipCpp->type())
{
case QEvent::Timer:
sipType = sipType_QTimerEvent;
break;
case QEvent::ChildAdded:
case QEvent::ChildPolished:
case QEvent::ChildRemoved:
sipType = sipType_QChildEvent;
break;
case QEvent::DynamicPropertyChange:
sipType = sipType_QDynamicPropertyChangeEvent;
break;
default:
sipType = 0;
}
%End
public:
enum Type /BaseType=IntEnum/
{
None,
Timer,
MouseButtonPress,
MouseButtonRelease,
MouseButtonDblClick,
MouseMove,
KeyPress,
KeyRelease,
FocusIn,
FocusOut,
Enter,
Leave,
Paint,
Move,
Resize,
Show,
Hide,
Close,
Quit,
ParentChange,
ParentAboutToChange,
ThreadChange,
WindowActivate,
WindowDeactivate,
ShowToParent,
HideToParent,
Wheel,
WindowTitleChange,
WindowIconChange,
ApplicationWindowIconChange,
ApplicationFontChange,
ApplicationLayoutDirectionChange,
ApplicationPaletteChange,
PaletteChange,
Clipboard,
MetaCall,
SockAct,
WinEventAct,
DeferredDelete,
DragEnter,
DragMove,
DragLeave,
Drop,
ChildAdded,
ChildPolished,
ChildRemoved,
PolishRequest,
Polish,
LayoutRequest,
UpdateRequest,
UpdateLater,
ContextMenu,
InputMethod,
TabletMove,
LocaleChange,
LanguageChange,
LayoutDirectionChange,
TabletPress,
TabletRelease,
OkRequest,
IconDrag,
FontChange,
EnabledChange,
ActivationChange,
StyleChange,
IconTextChange,
ModifiedChange,
MouseTrackingChange,
WindowBlocked,
WindowUnblocked,
WindowStateChange,
ToolTip,
WhatsThis,
StatusTip,
ActionChanged,
ActionAdded,
ActionRemoved,
FileOpen,
Shortcut,
ShortcutOverride,
WhatsThisClicked,
ToolBarChange,
ApplicationActivate,
ApplicationActivated,
ApplicationDeactivate,
ApplicationDeactivated,
QueryWhatsThis,
EnterWhatsThisMode,
LeaveWhatsThisMode,
ZOrderChange,
HoverEnter,
HoverLeave,
HoverMove,
GraphicsSceneMouseMove,
GraphicsSceneMousePress,
GraphicsSceneMouseRelease,
GraphicsSceneMouseDoubleClick,
GraphicsSceneContextMenu,
GraphicsSceneHoverEnter,
GraphicsSceneHoverMove,
GraphicsSceneHoverLeave,
GraphicsSceneHelp,
GraphicsSceneDragEnter,
GraphicsSceneDragMove,
GraphicsSceneDragLeave,
GraphicsSceneDrop,
GraphicsSceneWheel,
GraphicsSceneResize,
GraphicsSceneMove,
KeyboardLayoutChange,
DynamicPropertyChange,
TabletEnterProximity,
TabletLeaveProximity,
NonClientAreaMouseMove,
NonClientAreaMouseButtonPress,
NonClientAreaMouseButtonRelease,
NonClientAreaMouseButtonDblClick,
MacSizeChange,
ContentsRectChange,
CursorChange,
ToolTipChange,
GrabMouse,
UngrabMouse,
GrabKeyboard,
UngrabKeyboard,
StateMachineSignal,
StateMachineWrapped,
TouchBegin,
TouchUpdate,
TouchEnd,
NativeGesture,
RequestSoftwareInputPanel,
CloseSoftwareInputPanel,
WinIdChange,
Gesture,
GestureOverride,
FocusAboutToChange,
ScrollPrepare,
Scroll,
Expose,
InputMethodQuery,
OrientationChange,
TouchCancel,
PlatformPanel,
ApplicationStateChange,
ReadOnlyChange,
PlatformSurface,
TabletTrackingChange,
GraphicsSceneLeave,
EnterEditFocus,
LeaveEditFocus,
%If (Qt_6_6_0 -)
DevicePixelRatioChange,
%End
%If (Qt_6_7_0 -)
ChildWindowAdded,
%End
%If (Qt_6_7_0 -)
ChildWindowRemoved,
%End
%If (Qt_6_7_0 -)
ParentWindowAboutToChange,
%End
%If (Qt_6_7_0 -)
ParentWindowChange,
%End
User,
MaxUser,
};
explicit QEvent(QEvent::Type type);
QEvent(int type) /Deprecated, NoDerived/;
%MethodCode
// This overload allows an int to be passed as is rather than being wrapped in
// a QEvent.Type. This was usefull before enums supported missing members and
// is now deprecated.
sipCpp = new sipQEvent(static_cast<QEvent::Type>(a0));
%End
virtual ~QEvent();
QEvent::Type type() const;
bool spontaneous() const;
virtual void setAccepted(bool accepted);
bool isAccepted() const;
void accept();
void ignore();
static int registerEventType(int hint = -1);
bool isInputEvent() const;
bool isPointerEvent() const;
bool isSinglePointEvent() const;
virtual QEvent *clone() const /Factory/;
};
class QTimerEvent : public QEvent /NoDefaultCtors/
{
%TypeHeaderCode
#include <qcoreevent.h>
%End
public:
explicit QTimerEvent(int timerId);
virtual ~QTimerEvent();
int timerId() const;
virtual QTimerEvent *clone() const /Factory/;
%If (Qt_6_8_0 -)
int id() const;
%MethodCode
sipRes = qToUnderlying<Qt::TimerId>(sipCpp->id());
%End
%End
};
class QChildEvent : public QEvent /NoDefaultCtors/
{
%TypeHeaderCode
#include <qcoreevent.h>
%End
public:
QChildEvent(QEvent::Type type, QObject *child);
QChildEvent(int type, QObject *child) /NoDerived/;
%MethodCode
sipCpp = new sipQChildEvent(static_cast<QEvent::Type>(a0), a1);
%End
virtual ~QChildEvent();
QObject *child() const;
bool added() const;
bool polished() const;
bool removed() const;
virtual QChildEvent *clone() const /Factory/;
};
class QDynamicPropertyChangeEvent : public QEvent /NoDefaultCtors/
{
%TypeHeaderCode
#include <qcoreevent.h>
%End
public:
explicit QDynamicPropertyChangeEvent(const QByteArray &name);
virtual ~QDynamicPropertyChangeEvent();
QByteArray propertyName() const;
virtual QDynamicPropertyChangeEvent *clone() const /Factory/;
};
@@ -0,0 +1,91 @@
// qcryptographichash.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QCryptographicHash
{
%TypeHeaderCode
#include <qcryptographichash.h>
%End
public:
enum Algorithm
{
Md4,
Md5,
Sha1,
Sha224,
Sha256,
Sha384,
Sha512,
Sha3_224,
Sha3_256,
Sha3_384,
Sha3_512,
Keccak_224,
Keccak_256,
Keccak_384,
Keccak_512,
Blake2b_160,
Blake2b_256,
Blake2b_384,
Blake2b_512,
Blake2s_128,
Blake2s_160,
Blake2s_224,
Blake2s_256,
};
explicit QCryptographicHash(QCryptographicHash::Algorithm method);
~QCryptographicHash();
void reset();
%If (Qt_6_3_0 -)
void addData(QByteArrayView data);
%End
%If (- Qt_6_3_0)
void addData(const QByteArray &data);
%End
void addData(const char *data /Array/, qsizetype length /ArraySize/);
bool addData(QIODevice *device);
QByteArray result() const;
%If (Qt_6_3_0 -)
QByteArrayView resultView() const;
%End
%If (Qt_6_3_0 -)
static QByteArray hash(QByteArrayView data, QCryptographicHash::Algorithm method);
%End
%If (- Qt_6_3_0)
static QByteArray hash(const QByteArray &data, QCryptographicHash::Algorithm method);
%End
static int hashLength(QCryptographicHash::Algorithm method);
%If (Qt_6_5_0 -)
void swap(QCryptographicHash &other /Constrained/);
%End
%If (Qt_6_5_0 -)
QCryptographicHash::Algorithm algorithm() const;
%End
%If (Qt_6_5_0 -)
static bool supportsAlgorithm(QCryptographicHash::Algorithm method);
%End
private:
QCryptographicHash(const QCryptographicHash &);
};
@@ -0,0 +1,633 @@
// qdatastream.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QDataStream : public QIODeviceBase
{
%TypeHeaderCode
#include <qdatastream.h>
%End
public:
enum Version /BaseType=IntEnum/
{
Qt_1_0,
Qt_2_0,
Qt_2_1,
Qt_3_0,
Qt_3_1,
Qt_3_3,
Qt_4_0,
Qt_4_1,
Qt_4_2,
Qt_4_3,
Qt_4_4,
Qt_4_5,
Qt_4_6,
Qt_4_7,
Qt_4_8,
Qt_4_9,
Qt_5_0,
Qt_5_1,
Qt_5_2,
Qt_5_3,
Qt_5_4,
Qt_5_5,
Qt_5_6,
Qt_5_7,
Qt_5_8,
Qt_5_9,
Qt_5_10,
Qt_5_11,
Qt_5_12,
Qt_5_13,
Qt_5_14,
Qt_5_15,
Qt_6_0,
%If (Qt_6_1_0 -)
Qt_6_1,
%End
%If (Qt_6_2_0 -)
Qt_6_2,
%End
%If (Qt_6_3_0 -)
Qt_6_3,
%End
%If (Qt_6_4_0 -)
Qt_6_4,
%End
%If (Qt_6_5_0 -)
Qt_6_5,
%End
%If (Qt_6_6_0 -)
Qt_6_6,
%End
%If (Qt_6_7_0 -)
Qt_6_7,
%End
%If (Qt_6_8_0 -)
Qt_6_8,
%End
};
enum ByteOrder
{
BigEndian,
LittleEndian,
};
enum Status
{
Ok,
ReadPastEnd,
ReadCorruptData,
WriteFailed,
%If (Qt_6_7_0 -)
SizeLimitExceeded,
%End
};
enum FloatingPointPrecision
{
SinglePrecision,
DoublePrecision,
};
QDataStream();
explicit QDataStream(QIODevice *);
QDataStream(QByteArray * /Constrained/, QIODeviceBase::OpenMode flags);
QDataStream(const QByteArray &);
~QDataStream();
QIODevice *device() const;
void setDevice(QIODevice *);
bool atEnd() const;
QDataStream::Status status() const;
void setStatus(QDataStream::Status status);
void resetStatus();
QDataStream::FloatingPointPrecision floatingPointPrecision() const;
void setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision);
QDataStream::ByteOrder byteOrder() const;
void setByteOrder(QDataStream::ByteOrder);
int version() const;
void setVersion(int);
%If (Qt_6_7_0 -)
SIP_PYOBJECT readBytes() /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
char *s;
qint64 l;
Py_BEGIN_ALLOW_THREADS
sipCpp->readBytes(s, l);
Py_END_ALLOW_THREADS
if ((sipRes = PyBytes_FromStringAndSize(s, l)) == NULL)
sipIsErr = 1;
if (s)
delete[] s;
%End
%End
%If (- Qt_6_7_0)
SIP_PYOBJECT readBytes() /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
char *s;
uint l;
Py_BEGIN_ALLOW_THREADS
sipCpp->readBytes(s, l);
Py_END_ALLOW_THREADS
if ((sipRes = PyBytes_FromStringAndSize(s, l)) == NULL)
sipIsErr = 1;
if (s)
delete[] s;
%End
%End
%If (Qt_6_7_0 -)
SIP_PYOBJECT readRawData(qint64 len) /Encoding="None",ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
len = sipCpp->readRawData(s, a0);
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
%End
%If (- Qt_6_7_0)
SIP_PYOBJECT readRawData(int len) /Encoding="None",ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
int len;
Py_BEGIN_ALLOW_THREADS
len = sipCpp->readRawData(s, a0);
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
%End
%If (Qt_6_7_0 -)
QDataStream &writeBytes(SIP_PYBUFFER) /ReleaseGIL/;
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
sipRes = &sipCpp->writeBytes(reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%End
%If (- Qt_6_7_0)
QDataStream &writeBytes(SIP_PYBUFFER) /ReleaseGIL/;
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
sipRes = &sipCpp->writeBytes(reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%End
%If (Qt_6_7_0 -)
qint64 writeRawData(SIP_PYBUFFER) /ReleaseGIL/;
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->writeRawData(reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%End
%If (- Qt_6_7_0)
int writeRawData(SIP_PYBUFFER) /ReleaseGIL/;
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->writeRawData(reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%End
%If (Qt_6_7_0 -)
qint64 skipRawData(qint64 len) /ReleaseGIL/;
%End
%If (- Qt_6_7_0)
int skipRawData(int len) /ReleaseGIL/;
%End
void startTransaction();
bool commitTransaction();
void rollbackTransaction();
void abortTransaction();
// Extra methods to give explicit control over the simple data types being read and written.
int readInt() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
qint8 readInt8() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
quint8 readUInt8() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
qint16 readInt16() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
quint16 readUInt16() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
qint32 readInt32() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
quint32 readUInt32() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
qint64 readInt64() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
quint64 readUInt64() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
bool readBool() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
float readFloat() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
double readDouble() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp >> sipRes;
Py_END_ALLOW_THREADS
%End
SIP_PYOBJECT readString() /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Note that this should really be called readCString().
char *s;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> s;
Py_END_ALLOW_THREADS
if (s)
{
sipRes = PyBytes_FromString(s);
delete[] s;
}
else
{
sipRes = Py_None;
Py_INCREF(Py_None);
}
%End
void writeInt(int i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeInt8(qint8 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeUInt8(quint8 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeInt16(qint16 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeUInt16(quint16 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeInt32(qint32 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeUInt32(quint32 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeInt64(qint64 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeUInt64(quint64 i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeBool(bool i) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeFloat(float f) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeDouble(double f) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
void writeString(const char *str /Encoding="None"/) /ReleaseGIL/;
%MethodCode
// Note that this should really be called writeCString().
Py_BEGIN_ALLOW_THREADS
*sipCpp << a0;
Py_END_ALLOW_THREADS
%End
QString readQString() /ReleaseGIL/;
%MethodCode
sipRes = new QString;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQString(const QString &qstr) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
QStringList readQStringList() /ReleaseGIL/;
%MethodCode
sipRes = new QStringList;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQStringList(const QStringList &qstrlst) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
QVariant readQVariant() /ReleaseGIL/;
%MethodCode
sipRes = new QVariant;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQVariant(const QVariant &qvar) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
QVariantList readQVariantList() /ReleaseGIL/;
%MethodCode
sipRes = new QVariantList;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQVariantList(const QVariantList &qvarlst) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
QVariantMap readQVariantMap() /ReleaseGIL/;
%MethodCode
sipRes = new QVariantMap;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQVariantMap(const QVariantMap &qvarmap) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
QVariantHash readQVariantHash() /ReleaseGIL/;
%MethodCode
sipRes = new QVariantHash;
Py_BEGIN_ALLOW_THREADS
*sipCpp >> *sipRes;
Py_END_ALLOW_THREADS
%End
void writeQVariantHash(const QVariantHash &qvarhash) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
*sipCpp << *a0;
Py_END_ALLOW_THREADS
%End
private:
QDataStream(const QDataStream &);
};
QDataStream &operator>>(QDataStream &s, QKeyCombination &combination /Constrained/) /ReleaseGIL/;
QDataStream &operator<<(QDataStream &s, QKeyCombination combination) /ReleaseGIL/;
@@ -0,0 +1,583 @@
// qdatetime.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QDate /TypeHintIn="Union[QDate, datetime.date]"/
{
%TypeHeaderCode
#include <qdatetime.h>
%End
%TypeCode
#include <QHash>
%End
%ConvertToTypeCode
// Allow a Python date object whenever a QDate is expected.
if (sipIsErr == NULL)
return (sipGetDate(sipPy, 0) ||
sipCanConvertToType(sipPy, sipType_QDate, SIP_NO_CONVERTORS));
sipDateDef py_date;
if (sipGetDate(sipPy, &py_date))
{
*sipCppPtr = new QDate(py_date.pd_year,
py_date.pd_month,
py_date.pd_day);
return sipGetState(sipTransferObj);
}
*sipCppPtr = reinterpret_cast<QDate *>(sipConvertToType(sipPy, sipType_QDate, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
%End
%PickleCode
sipRes = Py_BuildValue("iii", sipCpp->year(), sipCpp->month(), sipCpp->day());
%End
public:
QDate();
QDate(int y, int m, int d);
QDate(int y, int m, int d, QCalendar cal);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QDate()");
}
else
{
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QDate(%i, %i, %i)", sipCpp->year(),
sipCpp->month(), sipCpp->day());
}
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(sipCpp->toString(Qt::ISODate));
%End
SIP_PYOBJECT toPyDate() const /TypeHint="datetime.date"/;
%MethodCode
// Convert to a Python date object.
sipDateDef py_date;
py_date.pd_year = sipCpp->year();
py_date.pd_month = sipCpp->month();
py_date.pd_day = sipCpp->day();
sipRes = sipFromDate(&py_date);
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
bool isValid() const;
int year() const;
int year(QCalendar cal) const;
int month() const;
int month(QCalendar cal) const;
int day() const;
int day(QCalendar cal) const;
int dayOfWeek() const;
int dayOfWeek(QCalendar cal) const;
int dayOfYear() const;
int dayOfYear(QCalendar cal) const;
int daysInMonth() const;
int daysInMonth(QCalendar cal) const;
int daysInYear() const;
int daysInYear(QCalendar cal) const;
int weekNumber(int *yearNumber = 0) const;
// In Qt v6.7 this was replaced by two overloads bu twe need to retain the optional keyword argument.
QString toString(const QString &format, QCalendar cal = QCalendar()) const;
QString toString(Qt::DateFormat format = Qt::TextDate) const;
QDate addDays(qint64 days) const;
QDate addMonths(int months) const;
QDate addMonths(int months, QCalendar cal) const;
QDate addYears(int years) const;
QDate addYears(int years, QCalendar cal) const;
static QDate currentDate();
static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate);
// Qt v6.7 replaced this with two overloads but we need to retain the optional keyword argument.
static QDate fromString(const QString &string, const QString &format, QCalendar cal = QCalendar());
%If (Qt_6_7_0 -)
// This replaces two overloads added in Qy v6.7 designed to maintain compatibility regarding optional keyword arguments.
static QDate fromString(const QString &string, const QString &format, int baseYear, QCalendar cal = QCalendar());
%End
static bool isValid(int y, int m, int d);
static bool isLeapYear(int year);
static QDate fromJulianDay(qint64 jd);
qint64 toJulianDay() const;
bool setDate(int year, int month, int date);
void getDate(int *year, int *month, int *day) const;
// The arguments are marked as deprecated in Qt v6.9.
QDateTime startOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const;
QDateTime startOfDay(const QTimeZone &zone) const;
// The arguments are marked as deprecated in Qt v6.9.
QDateTime endOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const;
QDateTime endOfDay(const QTimeZone &zone) const;
bool setDate(int year, int month, int day, QCalendar cal);
qint64 daysTo(QDate d) const;
};
class QTime /TypeHintIn="Union[QTime, datetime.time]"/
{
%TypeHeaderCode
#include <qdatetime.h>
%End
%TypeCode
#include <QHash>
%End
%ConvertToTypeCode
// Allow a Python time object whenever a QTime is expected.
if (sipIsErr == NULL)
return (sipGetTime(sipPy, 0) ||
sipCanConvertToType(sipPy, sipType_QTime, SIP_NO_CONVERTORS));
sipTimeDef py_time;
if (sipGetTime(sipPy, &py_time))
{
*sipCppPtr = new QTime(py_time.pt_hour,
py_time.pt_minute,
py_time.pt_second,
py_time.pt_microsecond / 1000);
return sipGetState(sipTransferObj);
}
*sipCppPtr = reinterpret_cast<QTime *>(sipConvertToType(sipPy, sipType_QTime, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
%End
%PickleCode
sipRes = Py_BuildValue("iiii", sipCpp->hour(), sipCpp->minute(), sipCpp->second(), sipCpp->msec());
%End
public:
QTime();
QTime(int h, int m, int second = 0, int msec = 0);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QTime()");
}
else
{
sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QTime(%i, %i", sipCpp->hour(),
sipCpp->minute());
if (sipCpp->second() || sipCpp->msec())
{
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(", %i", sipCpp->second()));
if (sipCpp->msec())
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(", %i", sipCpp->msec()));
}
qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")"));
}
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(sipCpp->toString(Qt::ISODate));
%End
SIP_PYOBJECT toPyTime() const /TypeHint="datetime.time"/;
%MethodCode
// Convert to a Python time object.
sipTimeDef py_time;
py_time.pt_hour = sipCpp->hour();
py_time.pt_minute = sipCpp->minute();
py_time.pt_second = sipCpp->second();
py_time.pt_microsecond = sipCpp->msec() * 1000;
sipRes = sipFromTime(&py_time);
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
bool isValid() const;
int hour() const;
int minute() const;
int second() const;
int msec() const;
QString toString(Qt::DateFormat format = Qt::TextDate) const;
QString toString(const QString &format) const;
bool setHMS(int h, int m, int s, int msec = 0);
QTime addSecs(int secs) const;
QTime addMSecs(int ms) const;
static QTime currentTime();
static QTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate);
static QTime fromString(const QString &s, const QString &format);
static bool isValid(int h, int m, int s, int msec = 0);
static QTime fromMSecsSinceStartOfDay(int msecs);
int msecsSinceStartOfDay() const;
int secsTo(QTime t) const;
int msecsTo(QTime t) const;
};
class QDateTime /TypeHintIn="Union[QDateTime, datetime.datetime]"/
{
%TypeHeaderCode
#include <qdatetime.h>
%End
%TypeCode
#include <QHash>
%End
%ConvertToTypeCode
// Allow a Python datetime object whenever a QDateTime is expected.
if (sipIsErr == NULL)
return (sipGetDateTime(sipPy, 0, 0) ||
sipCanConvertToType(sipPy, sipType_QDateTime, SIP_NO_CONVERTORS));
sipDateDef py_date;
sipTimeDef py_time;
if (sipGetDateTime(sipPy, &py_date, &py_time))
{
QDate qdate(py_date.pd_year,
py_date.pd_month,
py_date.pd_day);
QTime qtime(py_time.pt_hour,
py_time.pt_minute,
py_time.pt_second,
py_time.pt_microsecond / 1000);
QDateTime *qdt = new QDateTime(qdate, qtime);
*sipCppPtr = qdt;
return sipGetState(sipTransferObj);
}
*sipCppPtr = reinterpret_cast<QDateTime *>(sipConvertToType(sipPy, sipType_QDateTime, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
%End
%PickleCode
QDate qd = sipCpp->date();
QTime qt = sipCpp->time();
sipRes = Py_BuildValue("iiiiiiii", qd.year(), qd.month(), qd.day(),
qt.hour(), qt.minute(), qt.second(), qt.msec(),
(int)sipCpp->timeSpec());
%End
public:
%If (Qt_6_7_0 -)
enum class TransitionResolution
{
Reject,
RelativeToBefore,
RelativeToAfter,
PreferBefore,
PreferAfter,
PreferStandard,
PreferDaylightSaving,
LegacyBehavior,
};
%End
QDateTime();
QDateTime(const QDateTime &other);
QDateTime(int year, int month, int day, int hour, int minute, int second = 0, int msec = 0, int timeSpec = 0) /NoDerived/;
%MethodCode
// This ctor is mainly supplied to allow pickling.
QDate qd(a0, a1, a2);
QTime qt(a3, a4, a5, a6);
sipCpp = new QDateTime(qd, qt, (Qt::TimeSpec)a7);
%End
%If (Qt_6_7_0 -)
// The resolve argument is not optional so that the overload with deprecated arguments continues to work.
QDateTime(QDate date, QTime time, QDateTime::TransitionResolution resolve) [(QDate date, QTime time, QDateTime::TransitionResolution resolve = QDateTime::TransitionResolution::LegacyBehavior)];
%End
// The optional arguments are marked as deprecated in Qt v6.9.
QDateTime(QDate date, QTime time, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0);
%If (Qt_6_7_0 -)
QDateTime(QDate date, QTime time, const QTimeZone &timeZone, QDateTime::TransitionResolution resolve = QDateTime::TransitionResolution::LegacyBehavior);
%End
%If (- Qt_6_7_0)
QDateTime(QDate date, QTime time, const QTimeZone &timeZone);
%End
~QDateTime();
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QDateTime()");
}
else
{
QDate qd = sipCpp->date();
QTime qt = sipCpp->time();
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QDateTime(%i, %i, %i, %i, %i",
qd.year(), qd.month(), qd.day(), qt.hour(), qt.minute());
if (qt.second() || qt.msec() || sipCpp->timeSpec() != Qt::LocalTime)
{
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(", %i", qt.second()));
if (qt.msec() || sipCpp->timeSpec() != Qt::LocalTime)
{
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(", %i", qt.msec()));
if (sipCpp->timeSpec() != Qt::LocalTime)
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(", PyQt6.QtCore.Qt.TimeSpec(%i)",
(int)sipCpp->timeSpec()));
}
}
qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")"));
}
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(sipCpp->toString(Qt::ISODate));
%End
SIP_PYOBJECT toPyDateTime() const /TypeHint="datetime.datetime"/;
%MethodCode
// Convert to a Python datetime object.
sipDateDef py_date;
QDate qd = sipCpp->date();
py_date.pd_year = qd.year();
py_date.pd_month = qd.month();
py_date.pd_day = qd.day();
sipTimeDef py_time;
QTime qt = sipCpp->time();
py_time.pt_hour = qt.hour();
py_time.pt_minute = qt.minute();
py_time.pt_second = qt.second();
py_time.pt_microsecond = qt.msec() * 1000;
sipRes = sipFromDateTime(&py_date, &py_time);
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
bool isValid() const;
QDate date() const;
QTime time() const;
Qt::TimeSpec timeSpec() const;
void setTimeSpec(Qt::TimeSpec spec);
// This was replaced with two overloads in Qt v6.7 but we need the optional keyword argument.
QString toString(const QString &format, QCalendar cal = QCalendar()) const;
QString toString(Qt::DateFormat format = Qt::TextDate) const;
QDateTime addDays(qint64 days) const;
QDateTime addMonths(int months) const;
QDateTime addYears(int years) const;
QDateTime addSecs(qint64 secs) const;
QDateTime addMSecs(qint64 msecs) const;
QDateTime toTimeSpec(Qt::TimeSpec spec) const;
QDateTime toLocalTime() const;
QDateTime toUTC() const;
qint64 daysTo(const QDateTime &) const;
qint64 secsTo(const QDateTime &) const;
static QDateTime currentDateTime();
%If (Qt_6_5_0 -)
static QDateTime currentDateTime(const QTimeZone &zone);
%End
static QDateTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate);
// Qt v6.7 replaced this with two overloads but we need to retain the optional keyword argument.
static QDateTime fromString(const QString &string, const QString &format, QCalendar cal = QCalendar());
%If (Qt_6_7_0 -)
// This replaces two overloads added in Qy v6.7 designed to maintain compatibility regarding optional keyword arguments.
static QDateTime fromString(const QString &string, const QString &format, int baseYear, QCalendar cal = QCalendar());
%End
qint64 toMSecsSinceEpoch() const;
void setMSecsSinceEpoch(qint64 msecs);
qint64 msecsTo(const QDateTime &) const;
static QDateTime currentDateTimeUtc();
static qint64 currentMSecsSinceEpoch();
void swap(QDateTime &other /Constrained/);
int offsetFromUtc() const;
QTimeZone timeZone() const;
QString timeZoneAbbreviation() const;
bool isDaylightTime() const;
void setOffsetFromUtc(int offsetSeconds);
%If (Qt_6_7_0 -)
void setTimeZone(const QTimeZone &toZone, QDateTime::TransitionResolution resolve = QDateTime::TransitionResolution::LegacyBehavior);
%End
%If (- Qt_6_7_0)
void setTimeZone(const QTimeZone &toZone);
%End
QDateTime toOffsetFromUtc(int offsetSeconds) const;
QDateTime toTimeZone(const QTimeZone &toZone) const;
// The optional arguments are marked as deprecated in Qt v6.9.
static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0);
static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone);
qint64 toSecsSinceEpoch() const;
void setSecsSinceEpoch(qint64 secs);
// The optional arguments are marked as deprecated in Qt v6.9.
static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0);
static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone);
static qint64 currentSecsSinceEpoch();
enum class YearRange
{
First,
Last,
};
%If (Qt_6_7_0 -)
void setDate(QDate date, QDateTime::TransitionResolution resolve = QDateTime::TransitionResolution::LegacyBehavior);
%End
%If (- Qt_6_7_0)
void setDate(QDate date);
%End
%If (Qt_6_7_0 -)
void setTime(QTime time, QDateTime::TransitionResolution resolve = QDateTime::TransitionResolution::LegacyBehavior);
%End
%If (- Qt_6_7_0)
void setTime(QTime time);
%End
%If (Qt_6_5_0 -)
QTimeZone timeRepresentation() const;
%End
};
QDataStream &operator<<(QDataStream &, QDate) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QDate & /Constrained/) /ReleaseGIL/;
QDataStream &operator<<(QDataStream &, QTime) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QTime & /Constrained/) /ReleaseGIL/;
QDataStream &operator<<(QDataStream &, const QDateTime &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QDateTime & /Constrained/) /ReleaseGIL/;
%If (Qt_6_7_0 -)
bool operator==(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator==(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator==(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator==(QTime lhs, QTime rhs);
%End
bool operator==(const QDateTime &lhs, const QDateTime &rhs);
%If (Qt_6_7_0 -)
bool operator!=(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator!=(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator!=(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator!=(QTime lhs, QTime rhs);
%End
bool operator!=(const QDateTime &lhs, const QDateTime &rhs);
%If (Qt_6_7_0 -)
bool operator<(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator<(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator<(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator<(QTime lhs, QTime rhs);
%End
bool operator<(const QDateTime &lhs, const QDateTime &rhs);
%If (Qt_6_7_0 -)
bool operator<=(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator<=(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator<=(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator<=(QTime lhs, QTime rhs);
%End
bool operator<=(const QDateTime &lhs, const QDateTime &rhs);
%If (Qt_6_7_0 -)
bool operator>(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator>(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator>(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator>(QTime lhs, QTime rhs);
%End
bool operator>(const QDateTime &lhs, const QDateTime &rhs);
%If (Qt_6_7_0 -)
bool operator>=(const QDate &lhs, const QDate &rhs);
%End
%If (- Qt_6_7_0)
bool operator>=(QDate lhs, QDate rhs);
%End
%If (Qt_6_7_0 -)
bool operator>=(const QTime &lhs, const QTime &rhs);
%End
%If (- Qt_6_7_0)
bool operator>=(QTime lhs, QTime rhs);
%End
bool operator>=(const QDateTime &lhs, const QDateTime &rhs);
@@ -0,0 +1,108 @@
// qdeadlinetimer.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QDeadlineTimer
{
%TypeHeaderCode
#include <qdeadlinetimer.h>
%End
public:
%If (- Qt_6_6_0)
enum ForeverConstant
{
Forever,
};
%End
%If (Qt_6_6_0 -)
enum class ForeverConstant
{
Forever,
};
%End
// This was replaced in Qt v6.6 with two overloads but we need the optional keyword argument.
QDeadlineTimer(Qt::TimerType type = Qt::CoarseTimer);
QDeadlineTimer(QDeadlineTimer::ForeverConstant, Qt::TimerType type = Qt::CoarseTimer);
QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer);
void swap(QDeadlineTimer &other /Constrained/);
bool isForever() const;
bool hasExpired() const;
Qt::TimerType timerType() const;
void setTimerType(Qt::TimerType type);
qint64 remainingTime() const;
qint64 remainingTimeNSecs() const;
void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer);
void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0, Qt::TimerType type = Qt::CoarseTimer);
qint64 deadline() const;
qint64 deadlineNSecs() const;
void setDeadline(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer);
void setPreciseDeadline(qint64 secs, qint64 nsecs = 0, Qt::TimerType type = Qt::CoarseTimer);
static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs);
static QDeadlineTimer current(Qt::TimerType type = Qt::CoarseTimer);
QDeadlineTimer &operator+=(qint64 msecs);
QDeadlineTimer &operator-=(qint64 msecs);
};
%If (Qt_6_8_0 -)
bool operator==(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator==(QDeadlineTimer d1, QDeadlineTimer d2);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2);
%End
%If (Qt_6_8_0 -)
bool operator<(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator<(QDeadlineTimer d1, QDeadlineTimer d2);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2);
%End
%If (Qt_6_8_0 -)
bool operator>(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator>(QDeadlineTimer d1, QDeadlineTimer d2);
%End
%If (Qt_6_8_0 -)
bool operator>=(const QDeadlineTimer &lhs, const QDeadlineTimer &rhs);
%End
%If (- Qt_6_8_0)
bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2);
%End
QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs);
QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt);
QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs);
qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2);
@@ -0,0 +1,212 @@
// qdir.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QDir
{
%TypeHeaderCode
#include <qdir.h>
%End
public:
enum Filter /BaseType=Flag/
{
Dirs,
Files,
Drives,
NoSymLinks,
AllEntries,
TypeMask,
Readable,
Writable,
Executable,
PermissionMask,
Modified,
Hidden,
System,
AccessMask,
AllDirs,
CaseSensitive,
NoDotAndDotDot,
NoFilter,
NoDot,
NoDotDot,
};
typedef QFlags<QDir::Filter> Filters;
enum SortFlag /BaseType=Flag/
{
Name,
Time,
Size,
Unsorted,
SortByMask,
DirsFirst,
Reversed,
IgnoreCase,
DirsLast,
LocaleAware,
Type,
NoSort,
};
typedef QFlags<QDir::SortFlag> SortFlags;
QDir(const QString &path, const QString &nameFilter, QDir::SortFlags sort = QDir::SortFlags(QDir::Name | QDir::IgnoreCase), QDir::Filters filters = QDir::AllEntries);
QDir(const QDir &);
QDir(const QString &path = QString());
~QDir();
void setPath(const QString &path);
QString path() const;
QString absolutePath() const;
QString canonicalPath() const;
QString dirName() const;
QString filePath(const QString &fileName) const;
QString absoluteFilePath(const QString &fileName) const;
QString relativeFilePath(const QString &fileName) const;
bool cd(const QString &dirName);
bool cdUp();
QStringList nameFilters() const;
void setNameFilters(const QStringList &nameFilters);
QDir::Filters filter() const;
void setFilter(QDir::Filters filter);
QDir::SortFlags sorting() const;
void setSorting(QDir::SortFlags sort);
%If (Qt_6_5_0 -)
qsizetype count() const /__len__/;
%MethodCode
sipRes = sipCpp->count(Qt::Disambiguated);
%End
%End
%If (- Qt_6_5_0)
uint count() const /__len__/;
%End
%If (Qt_6_5_0 -)
QString operator[](qsizetype) const;
%MethodCode
Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
if (idx < 0)
sipIsErr = 1;
else
sipRes = new QString(sipCpp->operator[]((qsizetype)idx));
%End
%End
%If (- Qt_6_5_0)
QString operator[](int) const;
%MethodCode
Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
if (idx < 0)
sipIsErr = 1;
else
sipRes = new QString(sipCpp->operator[]((int)idx));
%End
%End
QStringList operator[](SIP_PYSLICE) const;
%MethodCode
Py_ssize_t start, stop, step, slicelength;
if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0)
{
sipIsErr = 1;
}
else
{
sipRes = new QStringList();
for (Py_ssize_t i = 0; i < slicelength; ++i)
{
(*sipRes) += (*sipCpp)[start];
start += step;
}
}
%End
int __contains__(const QString &) const;
%MethodCode
sipRes = bool(sipCpp->entryList().contains(*a0));
%End
static QStringList nameFiltersFromString(const QString &nameFilter);
QStringList entryList(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
QStringList entryList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
QFileInfoList entryInfoList(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
QFileInfoList entryInfoList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
%If (Qt_6_3_0 -)
bool mkdir(const QString &dirName, QFileDevice::Permissions permissions) const;
%End
bool mkdir(const QString &dirName) const;
bool rmdir(const QString &dirName) const;
bool mkpath(const QString &dirPath) const;
bool rmpath(const QString &dirPath) const;
bool isReadable() const;
bool exists() const;
bool isRoot() const;
static bool isRelativePath(const QString &path);
static bool isAbsolutePath(const QString &path);
bool isRelative() const;
bool isAbsolute() const;
bool makeAbsolute();
%If (- Qt_6_8_0)
bool operator==(const QDir &dir) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QDir &dir) const;
%End
bool remove(const QString &fileName);
bool rename(const QString &oldName, const QString &newName);
bool exists(const QString &name) const;
void refresh() const;
static QFileInfoList drives();
static QChar separator();
static bool setCurrent(const QString &path);
static QDir current();
static QString currentPath();
static QDir home();
static QString homePath();
static QDir root();
static QString rootPath();
static QDir temp();
static QString tempPath();
static bool match(const QStringList &filters, const QString &fileName);
static bool match(const QString &filter, const QString &fileName);
static QString cleanPath(const QString &path);
static QString toNativeSeparators(const QString &pathName);
static QString fromNativeSeparators(const QString &pathName);
static void setSearchPaths(const QString &prefix, const QStringList &searchPaths);
static void addSearchPath(const QString &prefix, const QString &path);
static QStringList searchPaths(const QString &prefix);
bool removeRecursively();
void swap(QDir &other /Constrained/);
static QChar listSeparator();
bool isEmpty(QDir::Filters filters = QDir::Filters(QDir::AllEntries | QDir::NoDotAndDotDot)) const;
};
%If (Qt_6_8_0 -)
bool operator!=(const QDir &lhs, const QDir &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QDir &lhs, const QDir &rhs);
%End
@@ -0,0 +1,55 @@
// qdiriterator.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QDirIterator
{
%TypeHeaderCode
#include <qdiriterator.h>
%End
public:
enum IteratorFlag /BaseType=Flag/
{
NoIteratorFlags,
FollowSymlinks,
Subdirectories,
};
typedef QFlags<QDirIterator::IteratorFlag> IteratorFlags;
QDirIterator(const QDir &dir, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
QDirIterator(const QString &path, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
QDirIterator(const QString &path, QDir::Filters filter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
QDirIterator(const QString &path, const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags);
~QDirIterator();
QString next();
%If (Qt_6_3_0 -)
QFileInfo nextFileInfo();
%End
bool hasNext() const;
QString fileName() const;
QString filePath() const;
QFileInfo fileInfo() const;
QString path() const;
private:
QDirIterator(const QDirIterator &);
};
@@ -0,0 +1,298 @@
// qeasingcurve.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QEasingCurve /TypeHintIn="Union[QEasingCurve, QEasingCurve.Type]"/
{
%TypeHeaderCode
#include <qeasingcurve.h>
%End
%TypeCode
// The EasingFunction callback doesn't provide a context so we support a fixed
// number of different functions.
const int ec_nr_custom_types = 10;
struct ec_custom_type {
PyObject *py_func;
QEasingCurve::EasingFunction func;
};
static qreal ec_call(int ec, qreal v);
static qreal ec_func_0(qreal v)
{
return ec_call(0, v);
}
static qreal ec_func_1(qreal v)
{
return ec_call(1, v);
}
static qreal ec_func_2(qreal v)
{
return ec_call(2, v);
}
static qreal ec_func_3(qreal v)
{
return ec_call(3, v);
}
static qreal ec_func_4(qreal v)
{
return ec_call(4, v);
}
static qreal ec_func_5(qreal v)
{
return ec_call(5, v);
}
static qreal ec_func_6(qreal v)
{
return ec_call(6, v);
}
static qreal ec_func_7(qreal v)
{
return ec_call(7, v);
}
static qreal ec_func_8(qreal v)
{
return ec_call(8, v);
}
static qreal ec_func_9(qreal v)
{
return ec_call(9, v);
}
static ec_custom_type ec_custom_types[ec_nr_custom_types] = {
{0, ec_func_0},
{0, ec_func_1},
{0, ec_func_2},
{0, ec_func_3},
{0, ec_func_4},
{0, ec_func_5},
{0, ec_func_6},
{0, ec_func_7},
{0, ec_func_8},
{0, ec_func_9},
};
static qreal ec_call(int ec, qreal v)
{
PyObject *res_obj;
qreal res = 0.0;
SIP_BLOCK_THREADS
res_obj = PyObject_CallFunction(ec_custom_types[ec].py_func, (char *)"(d)", (double)v);
if (res_obj)
{
PyErr_Clear();
res = PyFloat_AsDouble(res_obj);
Py_DECREF(res_obj);
if (PyErr_Occurred())
res_obj = 0;
}
if (!res_obj)
pyqt6_err_print();
SIP_UNBLOCK_THREADS
return res;
}
%End
%ConvertToTypeCode
// Allow a QEasingCurve::Type whenever a QEasingCurve is expected.
bool is_ec_type = true;
int ec_type = sipConvertToEnum(sipPy, sipType_QEasingCurve_Type);
if (PyErr_Occurred())
{
PyErr_Clear();
is_ec_type = false;
}
if (sipIsErr == NULL)
return (is_ec_type ||
sipCanConvertToType(sipPy, sipType_QEasingCurve, SIP_NO_CONVERTORS));
if (is_ec_type)
{
*sipCppPtr = new QEasingCurve(static_cast<QEasingCurve::Type>(ec_type));
return sipGetState(sipTransferObj);
}
*sipCppPtr = reinterpret_cast<QEasingCurve *>(sipConvertToType(sipPy,
sipType_QEasingCurve, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
return 0;
%End
public:
enum Type
{
Linear,
InQuad,
OutQuad,
InOutQuad,
OutInQuad,
InCubic,
OutCubic,
InOutCubic,
OutInCubic,
InQuart,
OutQuart,
InOutQuart,
OutInQuart,
InQuint,
OutQuint,
InOutQuint,
OutInQuint,
InSine,
OutSine,
InOutSine,
OutInSine,
InExpo,
OutExpo,
InOutExpo,
OutInExpo,
InCirc,
OutCirc,
InOutCirc,
OutInCirc,
InElastic,
OutElastic,
InOutElastic,
OutInElastic,
InBack,
OutBack,
InOutBack,
OutInBack,
InBounce,
OutBounce,
InOutBounce,
OutInBounce,
InCurve,
OutCurve,
SineCurve,
CosineCurve,
BezierSpline,
TCBSpline,
Custom,
};
QEasingCurve(QEasingCurve::Type type = QEasingCurve::Linear);
QEasingCurve(const QEasingCurve &other);
~QEasingCurve();
%If (- Qt_6_8_0)
bool operator==(const QEasingCurve &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QEasingCurve &other) const;
%End
qreal amplitude() const;
void setAmplitude(qreal amplitude);
qreal period() const;
void setPeriod(qreal period);
qreal overshoot() const;
void setOvershoot(qreal overshoot);
QEasingCurve::Type type() const;
void setType(QEasingCurve::Type type);
void setCustomType(SIP_PYCALLABLE func /TypeHint="Callable[[float], float]"/);
%MethodCode
int i;
ec_custom_type *ct;
for (i = 0; i < ec_nr_custom_types; ++i)
{
ct = &ec_custom_types[i];
if (!ct->py_func || ct->py_func == a0)
break;
}
if (i == ec_nr_custom_types)
{
PyErr_Format(PyExc_ValueError, "a maximum of %d different easing functions are supported", ec_nr_custom_types);
sipError = sipErrorFail;
}
else
{
if (!ct->py_func)
{
ct->py_func = a0;
Py_INCREF(a0);
}
sipCpp->setCustomType(ct->func);
}
%End
SIP_PYCALLABLE customType() const /TypeHint="Callable[[float], float]"/;
%MethodCode
QEasingCurve::EasingFunction func = sipCpp->customType();
sipRes = Py_None;
if (func)
{
for (int i = 0; i < ec_nr_custom_types; ++i)
{
if (ec_custom_types[i].func == func)
{
sipRes = ec_custom_types[i].py_func;
break;
}
}
}
Py_INCREF(sipRes);
%End
qreal valueForProgress(qreal progress) const;
void swap(QEasingCurve &other /Constrained/);
void addCubicBezierSegment(const QPointF &c1, const QPointF &c2, const QPointF &endPoint);
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
QList<QPointF> toCubicSpline() const;
};
QDataStream &operator<<(QDataStream &, const QEasingCurve & /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QEasingCurve & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator!=(const QEasingCurve &lhs, const QEasingCurve &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QEasingCurve &lhs, const QEasingCurve &rhs);
%End
@@ -0,0 +1,66 @@
// qelapsedtimer.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QElapsedTimer
{
%TypeHeaderCode
#include <qelapsedtimer.h>
%End
public:
QElapsedTimer();
enum ClockType
{
SystemTime,
MonotonicClock,
TickCounter,
MachAbsoluteTime,
PerformanceCounter,
};
static QElapsedTimer::ClockType clockType();
static bool isMonotonic();
void start();
qint64 restart();
void invalidate();
bool isValid() const;
qint64 elapsed() const;
bool hasExpired(qint64 timeout) const;
qint64 msecsSinceReference() const;
qint64 msecsTo(const QElapsedTimer &other) const;
qint64 secsTo(const QElapsedTimer &other) const;
qint64 nsecsElapsed() const;
};
bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2);
bool operator==(const QElapsedTimer &lhs, const QElapsedTimer &rhs);
bool operator!=(const QElapsedTimer &lhs, const QElapsedTimer &rhs);
%If (Qt_6_8_0 -)
bool operator>(const QElapsedTimer &lhs, const QElapsedTimer &rhs);
%End
%If (Qt_6_8_0 -)
bool operator<=(const QElapsedTimer &lhs, const QElapsedTimer &rhs);
%End
%If (Qt_6_8_0 -)
bool operator>=(const QElapsedTimer &lhs, const QElapsedTimer &rhs);
%End
@@ -0,0 +1,76 @@
// qeventloop.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QEventLoop : public QObject
{
%TypeHeaderCode
#include <qeventloop.h>
%End
public:
explicit QEventLoop(QObject *parent /TransferThis/ = 0);
virtual ~QEventLoop();
enum ProcessEventsFlag /BaseType=Flag/
{
AllEvents,
ExcludeUserInputEvents,
ExcludeSocketNotifiers,
WaitForMoreEvents,
};
typedef QFlags<QEventLoop::ProcessEventsFlag> ProcessEventsFlags;
bool processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /ReleaseGIL/;
void processEvents(QEventLoop::ProcessEventsFlags flags, int maximumTime) /ReleaseGIL/;
%If (Qt_6_7_0 -)
void processEvents(QEventLoop::ProcessEventsFlags flags, QDeadlineTimer deadline) /ReleaseGIL/;
%End
int exec(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/;
void exit(int returnCode = 0);
bool isRunning() const;
void wakeUp();
public slots:
void quit();
public:
virtual bool event(QEvent *event);
};
class QEventLoopLocker
{
%TypeHeaderCode
#include <qeventloop.h>
%End
public:
QEventLoopLocker() /ReleaseGIL/;
explicit QEventLoopLocker(QEventLoop *loop) /ReleaseGIL/;
explicit QEventLoopLocker(QThread *thread) /ReleaseGIL/;
~QEventLoopLocker();
%If (Qt_6_7_0 -)
void swap(QEventLoopLocker &other);
%End
private:
QEventLoopLocker(const QEventLoopLocker &);
};
@@ -0,0 +1,66 @@
// qfile.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QFile : public QFileDevice
{
%TypeHeaderCode
#include <qfile.h>
%End
public:
QFile();
QFile(const QString &name);
explicit QFile(QObject *parent /TransferThis/);
QFile(const QString &name, QObject *parent /TransferThis/);
virtual ~QFile();
virtual QString fileName() const;
void setFileName(const QString &name);
static QByteArray encodeName(const QString &fileName);
static QString decodeName(const QByteArray &localFileName);
static QString decodeName(const char *localFileName /Encoding="ASCII"/);
bool exists() const;
static bool exists(const QString &fileName);
QString symLinkTarget() const;
static QString symLinkTarget(const QString &fileName);
bool remove() /ReleaseGIL/;
static bool remove(const QString &fileName) /ReleaseGIL/;
bool rename(const QString &newName) /ReleaseGIL/;
static bool rename(const QString &oldName, const QString &newName) /ReleaseGIL/;
bool link(const QString &newName) /ReleaseGIL/;
static bool link(const QString &oldname, const QString &newName) /ReleaseGIL/;
bool copy(const QString &newName) /ReleaseGIL/;
static bool copy(const QString &fileName, const QString &newName) /ReleaseGIL/;
%If (Qt_6_3_0 -)
bool open(QIODeviceBase::OpenMode flags, QFileDevice::Permissions permissions) /ReleaseGIL/;
%End
virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/;
bool open(int fd, QIODeviceBase::OpenMode ioFlags, QFileDevice::FileHandleFlags handleFlags = QFileDevice::DontCloseHandle) /ReleaseGIL/;
virtual qint64 size() const;
virtual bool resize(qint64 sz);
static bool resize(const QString &filename, qint64 sz);
virtual QFileDevice::Permissions permissions() const;
static QFileDevice::Permissions permissions(const QString &filename);
virtual bool setPermissions(QFileDevice::Permissions permissionSpec);
static bool setPermissions(const QString &filename, QFileDevice::Permissions permissionSpec);
bool moveToTrash();
static bool moveToTrash(const QString &fileName, QString *pathInTrash /Out/ = 0);
};
@@ -0,0 +1,213 @@
// qfiledevice.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QFileDevice : public QIODevice /NoDefaultCtors/
{
%TypeHeaderCode
#include <qfiledevice.h>
%End
public:
enum FileError
{
NoError,
ReadError,
WriteError,
FatalError,
ResourceError,
OpenError,
AbortError,
TimeOutError,
UnspecifiedError,
RemoveError,
RenameError,
PositionError,
ResizeError,
PermissionsError,
CopyError,
};
enum Permission /BaseType=Flag/
{
ReadOwner,
WriteOwner,
ExeOwner,
ReadUser,
WriteUser,
ExeUser,
ReadGroup,
WriteGroup,
ExeGroup,
ReadOther,
WriteOther,
ExeOther,
};
typedef QFlags<QFileDevice::Permission> Permissions;
enum FileHandleFlag /BaseType=Flag/
{
AutoCloseHandle,
DontCloseHandle,
};
typedef QFlags<QFileDevice::FileHandleFlag> FileHandleFlags;
virtual ~QFileDevice();
QFileDevice::FileError error() const;
void unsetError();
virtual void close() /ReleaseGIL/;
virtual bool isSequential() const;
int handle() const;
virtual QString fileName() const;
virtual qint64 pos() const;
virtual bool seek(qint64 offset) /ReleaseGIL/;
virtual bool atEnd() const;
bool flush() /ReleaseGIL/;
virtual qint64 size() const;
virtual bool resize(qint64 sz);
virtual QFileDevice::Permissions permissions() const;
virtual bool setPermissions(QFileDevice::Permissions permissionSpec);
void *map(qint64 offset, qint64 size /ResultSize/, QFileDevice::MemoryMapFlags flags = QFileDevice::NoOptions) [uchar * (qint64 offset, qint64 size, QFileDevice::MemoryMapFlags flags = QFileDevice::NoOptions)];
bool unmap(void *address) [bool (uchar *address)];
protected:
virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QFileDevice::readData(s, a0) : sipCpp->readData(s, a0);
#else
len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
virtual SIP_PYOBJECT readLineData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QFileDevice::readLineData(s, a0) : sipCpp->readLineData(s, a0);
#else
len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipSelfWasArg ?
sipCpp->QFileDevice::writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len) :
sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
#else
sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
#endif
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
public:
enum FileTime
{
FileAccessTime,
FileBirthTime,
FileMetadataChangeTime,
FileModificationTime,
};
QDateTime fileTime(QFileDevice::FileTime time) const;
bool setFileTime(const QDateTime &newDate, QFileDevice::FileTime fileTime);
enum MemoryMapFlag /BaseType=Flag/
{
NoOptions,
MapPrivateOption,
};
typedef QFlags<QFileDevice::MemoryMapFlag> MemoryMapFlags;
};
@@ -0,0 +1,132 @@
// qfileinfo.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QFileInfo
{
%TypeHeaderCode
#include <qfileinfo.h>
%End
public:
QFileInfo();
explicit QFileInfo(const QFileDevice &file);
explicit QFileInfo(const QString &file);
QFileInfo(const QDir &dir, const QString &file);
QFileInfo(const QFileInfo &fileinfo);
~QFileInfo();
%If (- Qt_6_8_0)
bool operator==(const QFileInfo &fileinfo) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QFileInfo &fileinfo) const;
%End
void setFile(const QString &file);
void setFile(const QFileDevice &file);
void setFile(const QDir &dir, const QString &file);
bool exists() const;
void refresh();
QString filePath() const;
SIP_PYOBJECT __fspath__();
%MethodCode
sipRes = qpycore_PyObject_FromQString(QDir::toNativeSeparators(sipCpp->filePath()));
%End
QString absoluteFilePath() const;
QString canonicalFilePath() const;
QString fileName() const;
QString baseName() const;
QString completeBaseName() const;
QString suffix() const;
QString completeSuffix() const;
QString path() const;
QString absolutePath() const;
QString canonicalPath() const;
QDir dir() const;
QDir absoluteDir() const;
bool isReadable() const;
bool isWritable() const;
bool isExecutable() const;
bool isHidden() const;
bool isRelative() const;
bool isAbsolute() const;
bool makeAbsolute();
bool isFile() const;
bool isDir() const;
bool isSymLink() const;
bool isRoot() const;
QString owner() const;
uint ownerId() const;
QString group() const;
uint groupId() const;
bool permission(QFileDevice::Permissions permissions) const;
QFileDevice::Permissions permissions() const;
qint64 size() const;
QDateTime lastModified() const;
%If (Qt_6_6_0 -)
QDateTime lastModified(const QTimeZone &tz) const;
%End
QDateTime lastRead() const;
%If (Qt_6_6_0 -)
QDateTime lastRead(const QTimeZone &tz) const;
%End
bool caching() const;
void setCaching(bool on);
QString symLinkTarget() const;
QString bundleName() const;
bool isBundle() const;
bool isNativePath() const;
void swap(QFileInfo &other /Constrained/);
static bool exists(const QString &file);
QDateTime birthTime() const;
%If (Qt_6_6_0 -)
QDateTime birthTime(const QTimeZone &tz) const;
%End
QDateTime metadataChangeTime() const;
%If (Qt_6_6_0 -)
QDateTime metadataChangeTime(const QTimeZone &tz) const;
%End
QDateTime fileTime(QFileDevice::FileTime time) const;
%If (Qt_6_6_0 -)
QDateTime fileTime(QFileDevice::FileTime time, const QTimeZone &tz) const;
%End
bool isSymbolicLink() const;
bool isShortcut() const;
bool isJunction() const;
void stat();
%If (Qt_6_2_0 -)
QString junctionTarget() const;
%End
%If (Qt_6_4_0 -)
bool isAlias() const;
%End
%If (Qt_6_6_0 -)
QString readSymLink() const;
%End
};
typedef QList<QFileInfo> QFileInfoList;
%If (Qt_6_8_0 -)
bool operator!=(const QFileInfo &lhs, const QFileInfo &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QFileInfo &lhs, const QFileInfo &rhs);
%End
@@ -0,0 +1,37 @@
// qfileselector.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QFileSelector : public QObject
{
%TypeHeaderCode
#include <qfileselector.h>
%End
public:
explicit QFileSelector(QObject *parent /TransferThis/ = 0);
virtual ~QFileSelector();
QString select(const QString &filePath) const;
QUrl select(const QUrl &filePath) const;
QStringList extraSelectors() const;
void setExtraSelectors(const QStringList &list);
QStringList allSelectors() const;
};
@@ -0,0 +1,43 @@
// qfilesystemwatcher.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QFileSystemWatcher : public QObject
{
%TypeHeaderCode
#include <qfilesystemwatcher.h>
%End
public:
QFileSystemWatcher(QObject *parent /TransferThis/ = 0);
QFileSystemWatcher(const QStringList &paths, QObject *parent /TransferThis/ = 0);
virtual ~QFileSystemWatcher();
bool addPath(const QString &file);
QStringList addPaths(const QStringList &files);
QStringList directories() const;
QStringList files() const;
bool removePath(const QString &file);
QStringList removePaths(const QStringList &files);
signals:
void directoryChanged(const QString &path);
void fileChanged(const QString &path);
};
@@ -0,0 +1,49 @@
// This is the SIP interface definition for the QFlags based mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
template<ENUM>
%MappedType QFlags<ENUM> /PyQtFlags=1, TypeHint="ENUM"/
{
%TypeHeaderCode
#include <qglobal.h>
%End
%ConvertToTypeCode
bool is_enm = true;
unsigned enm = (unsigned)sipConvertToEnum(sipPy, sipType_ENUM);
if (PyErr_Occurred())
{
PyErr_Clear();
is_enm = false;
}
if (sipIsErr == NULL)
return is_enm;
*sipCppPtr = new QFlags<ENUM>(static_cast<ENUM>(enm));
return sipGetState(sipTransferObj);
%End
%ConvertFromTypeCode
return sipConvertFromEnum(sipCpp->operator::QFlags<ENUM>::Int(), sipType_ENUM);
%End
};
@@ -0,0 +1,198 @@
// qglobal.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qglobal.h>
%End
const int QT_VERSION;
const char *QT_VERSION_STR;
%If (- Qt_6_5_0)
const char *qVersion();
%End
%If (- Qt_6_5_0)
typedef signed char qint8 /PyInt/;
%End
%If (- Qt_6_5_0)
typedef unsigned char quint8 /PyInt/;
%End
%If (- Qt_6_5_0)
typedef short qint16;
%End
%If (- Qt_6_5_0)
typedef unsigned short quint16;
%End
%If (- Qt_6_5_0)
typedef int qint32;
%End
%If (- Qt_6_5_0)
typedef unsigned int quint32;
%End
%If (- Qt_6_5_0)
typedef long long qint64;
%End
%If (- Qt_6_5_0)
typedef unsigned long long quint64;
%End
%If (- Qt_6_5_0)
typedef qint64 qlonglong;
%End
%If (- Qt_6_5_0)
typedef quint64 qulonglong;
%End
%If (- Qt_6_5_0)
%If (PyQt_qreal_double)
typedef double qreal;
%End
%End
%If (- Qt_6_5_0)
%If (!PyQt_qreal_double)
typedef float qreal;
%End
%End
%If (- Qt_6_5_0)
typedef unsigned char uchar;
%End
%If (- Qt_6_5_0)
typedef unsigned short ushort;
%End
%If (- Qt_6_5_0)
typedef unsigned int uint;
%End
%If (- Qt_6_5_0)
typedef unsigned long ulong;
%End
%If (- Qt_6_5_0)
typedef long long qsizetype;
%End
%If (- Qt_6_5_0)
double qAbs(const double &t);
%End
%If (- Qt_6_5_0)
int qRound(qreal d);
%End
%If (- Qt_6_5_0)
qint64 qRound64(qreal d);
%End
%If (- Qt_6_5_0)
bool qFuzzyCompare(double p1, double p2);
%End
typedef void *QFunctionPointer;
// Minimal support for the Qt resource system to help porting from PyQt5.
%ModuleCode
QT_BEGIN_NAMESPACE
extern bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
extern bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
QT_END_NAMESPACE
%End
bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
// Mapped type for qintptr.
// Map qintptr onto sip.voidptr. This means either an address (on Windows) or
// an integer file descriptor (on everything else) can be used.
%MappedType qintptr /TypeHint="PyQt6.sip.voidptr"/
{
%TypeHeaderCode
#include <QtGlobal>
%End
%ConvertToTypeCode
qintptr ptr = (qintptr)sipConvertToVoidPtr(sipPy);
if (!sipIsErr)
return !PyErr_Occurred();
// Mapped types deal with pointers, so create one on the heap.
qintptr *heap = new qintptr;
*heap = ptr;
*sipCppPtr = heap;
// Make sure the pointer doesn't leak.
return SIP_TEMPORARY;
%End
%ConvertFromTypeCode
return sipConvertFromVoidPtr((void *)*sipCpp);
%End
};
// Mapped type for quintptr.
// Map quintptr onto sip.voidptr. This means either an address (on Windows) or
// an integer file descriptor (on everything else) can be used.
%MappedType quintptr /TypeHint="PyQt6.sip.voidptr"/
{
%TypeHeaderCode
#include <QtGlobal>
%End
%ConvertToTypeCode
quintptr ptr = (quintptr)sipConvertToVoidPtr(sipPy);
if (!sipIsErr)
return !PyErr_Occurred();
// Mapped types deal with pointers, so create one on the heap.
quintptr *heap = new quintptr;
*heap = ptr;
*sipCppPtr = heap;
// Make sure the pointer doesn't leak.
return SIP_TEMPORARY;
%End
%ConvertFromTypeCode
return sipConvertFromVoidPtr((void *)*sipCpp);
%End
};
// Implementations of pyqt[Set]PickleProtocol().
void pyqtSetPickleProtocol(SIP_PYOBJECT /TypeHint="Optional[int]"/);
%MethodCode
Py_XDECREF(qpycore_pickle_protocol);
qpycore_pickle_protocol = a0;
Py_INCREF(qpycore_pickle_protocol);
%End
SIP_PYOBJECT pyqtPickleProtocol() /TypeHint="Optional[int]"/;
%MethodCode
sipRes = qpycore_pickle_protocol;
if (!sipRes)
sipRes = Py_None;
Py_INCREF(sipRes);
%End
%If (- Qt_6_5_0)
bool qEnvironmentVariableIsEmpty(const char *varName);
%End
%If (- Qt_6_5_0)
bool qEnvironmentVariableIsSet(const char *varName);
%End
%If (- Qt_6_5_0)
QString qEnvironmentVariable(const char *varName);
%End
%If (- Qt_6_5_0)
QString qEnvironmentVariable(const char *varName, const QString &defaultValue);
%End
%If (- Qt_6_5_0)
int qEnvironmentVariableIntValue(const char *varName, bool *ok = 0);
%End
@@ -0,0 +1,65 @@
// qidentityproxymodel.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QIdentityProxyModel : public QAbstractProxyModel
{
%TypeHeaderCode
#include <qidentityproxymodel.h>
%End
public:
explicit QIdentityProxyModel(QObject *parent /TransferThis/ = 0);
virtual ~QIdentityProxyModel();
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
virtual QModelIndex parent(const QModelIndex &child) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const;
virtual void setSourceModel(QAbstractItemModel *sourceModel /KeepReference/);
virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild);
virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild);
%If (Qt_6_8_0 -)
bool handleSourceLayoutChanges() const;
%End
%If (Qt_6_8_0 -)
bool handleSourceDataChanges() const;
%End
protected:
%If (Qt_6_8_0 -)
void setHandleSourceLayoutChanges(bool);
%End
%If (Qt_6_8_0 -)
void setHandleSourceDataChanges(bool);
%End
};
@@ -0,0 +1,429 @@
// qiodevice.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QIODevice : public QObject, public QIODeviceBase
{
%TypeHeaderCode
#include <qiodevice.h>
%End
public:
QIODevice();
explicit QIODevice(QObject *parent /TransferThis/);
virtual ~QIODevice();
QIODeviceBase::OpenMode openMode() const;
void setTextModeEnabled(bool enabled);
bool isTextModeEnabled() const;
bool isOpen() const;
bool isReadable() const;
bool isWritable() const;
virtual bool isSequential() const;
int readChannelCount() const;
int writeChannelCount() const;
int currentReadChannel() const;
void setCurrentReadChannel(int channel);
int currentWriteChannel() const;
void setCurrentWriteChannel(int channel);
virtual bool open(QIODeviceBase::OpenMode mode) /ReleaseGIL/;
virtual void close() /ReleaseGIL/;
virtual qint64 pos() const;
virtual qint64 size() const;
virtual bool seek(qint64 pos) /ReleaseGIL/;
virtual bool atEnd() const;
virtual bool reset();
virtual qint64 bytesAvailable() const;
virtual qint64 bytesToWrite() const;
SIP_PYOBJECT read(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
len = sipCpp->read(s, a0);
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
SIP_PYOBJECT readLine(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Return a bytes object or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
len = sipCpp->readLine(s, a0);
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
QByteArray readLine() /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipRes = new QByteArray(sipCpp->readLine());
Py_END_ALLOW_THREADS
%End
QByteArray readAll() /ReleaseGIL/;
virtual bool canReadLine() const;
void startTransaction();
void commitTransaction();
void rollbackTransaction();
bool isTransactionStarted() const;
qint64 write(SIP_PYBUFFER) /ReleaseGIL/;
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->write(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
SIP_PYOBJECT peek(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/;
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
len = sipCpp->peek(s, a0);
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
qint64 skip(qint64 maxSize) /ReleaseGIL/;
virtual bool waitForReadyRead(int msecs) /ReleaseGIL/;
virtual bool waitForBytesWritten(int msecs) /ReleaseGIL/;
void ungetChar(char c /Encoding="None"/);
bool putChar(char c /Encoding="None"/) /ReleaseGIL/;
bool getChar(char *c /Encoding="None",Out/) /ReleaseGIL/;
QString errorString() const;
signals:
void aboutToClose();
void bytesWritten(qint64 bytes);
void channelBytesWritten(int channel, qint64 bytes);
void channelReadyRead(int channel);
void readChannelFinished();
void readyRead();
protected:
virtual SIP_PYOBJECT readData(qint64 maxlen) = 0 /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipCpp->readData(s, a0);
#else
len = sipCpp->sipProtect_readData(s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
%VirtualCatcherCode
PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1);
if (result)
{
PyObject *buf;
if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0)
{
if (buf == Py_None)
{
sipRes = -1L;
}
else
{
sipBufferInfoDef bi;
if (sipGetBufferInfo(buf, &bi) < 0)
{
sipBadCatcherResult(sipMethod);
sipIsErr = 1;
}
else
{
sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len;
memcpy(a0, bi.bi_buf, sipRes);
sipReleaseBufferInfo(&bi);
}
}
Py_DECREF(buf);
}
Py_DECREF(result);
}
%End
virtual SIP_PYOBJECT readLineData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QIODevice::readLineData(s, a0) : sipCpp->readLineData(s, a0);
#else
len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
%VirtualCatcherCode
PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1);
if (result)
{
PyObject *buf;
if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0)
{
if (buf == Py_None)
{
sipRes = -1L;
}
else
{
sipBufferInfoDef bi;
if (sipGetBufferInfo(buf, &bi) < 0)
{
sipBadCatcherResult(sipMethod);
sipIsErr = 1;
}
else
{
sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len;
memcpy(a0, bi.bi_buf, sipRes);
sipReleaseBufferInfo(&bi);
}
}
Py_DECREF(buf);
}
Py_DECREF(result);
}
%End
virtual qint64 writeData(SIP_PYBUFFER) = 0 /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
#else
sipRes = sipCpp->sipProtect_writeData(reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
#endif
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%VirtualCatcherCode
PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1);
if (result)
{
PyObject *buf;
if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0)
{
if (buf == Py_None)
{
sipRes = -1L;
}
else
{
sipBufferInfoDef bi;
if (sipGetBufferInfo(buf, &bi) < 0)
{
sipBadCatcherResult(sipMethod);
sipIsErr = 1;
}
else
{
if (bi.bi_readonly)
{
sipBadCatcherResult(sipMethod);
sipIsErr = 1;
}
else
{
sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len;
memcpy(bi.bi_buf, a0, sipRes);
}
sipReleaseBufferInfo(&bi);
}
}
Py_DECREF(buf);
}
Py_DECREF(result);
}
%End
virtual qint64 skipData(qint64 maxSize) /ReleaseGIL/;
void setOpenMode(QIODeviceBase::OpenMode openMode);
void setErrorString(const QString &errorString);
};
@@ -0,0 +1,50 @@
// qiodevicebase.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QIODeviceBase
{
%TypeHeaderCode
#include <qiodevicebase.h>
%End
public:
enum OpenModeFlag /BaseType=Flag/
{
NotOpen,
ReadOnly,
WriteOnly,
ReadWrite,
Append,
Truncate,
Text,
Unbuffered,
NewOnly,
ExistingOnly,
};
typedef QFlags<QIODeviceBase::OpenModeFlag> OpenMode;
protected:
%If (Qt_6_3_0 -)
~QIODeviceBase();
%End
};
@@ -0,0 +1,274 @@
// qitemselectionmodel.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QItemSelectionRange
{
%TypeHeaderCode
#include <qitemselectionmodel.h>
%End
public:
QItemSelectionRange();
QItemSelectionRange(const QModelIndex &atopLeft, const QModelIndex &abottomRight);
explicit QItemSelectionRange(const QModelIndex &index);
int top() const;
int left() const;
int bottom() const;
int right() const;
int width() const;
int height() const;
const QPersistentModelIndex &topLeft() const;
const QPersistentModelIndex &bottomRight() const;
QModelIndex parent() const;
const QAbstractItemModel *model() const;
bool contains(const QModelIndex &index) const;
bool contains(int row, int column, const QModelIndex &parentIndex) const;
bool intersects(const QItemSelectionRange &other) const;
%If (- Qt_6_8_0)
bool operator==(const QItemSelectionRange &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QItemSelectionRange &other) const;
%End
bool isValid() const;
QModelIndexList indexes() const;
QItemSelectionRange intersected(const QItemSelectionRange &other) const;
bool isEmpty() const;
void swap(QItemSelectionRange &other /Constrained/);
};
class QItemSelectionModel : public QObject
{
%TypeHeaderCode
#include <qitemselectionmodel.h>
%End
public:
enum SelectionFlag /BaseType=Flag/
{
NoUpdate,
Clear,
Select,
Deselect,
Toggle,
Current,
Rows,
Columns,
SelectCurrent,
ToggleCurrent,
ClearAndSelect,
};
typedef QFlags<QItemSelectionModel::SelectionFlag> SelectionFlags;
explicit QItemSelectionModel(QAbstractItemModel *model /TransferThis/ = 0);
QItemSelectionModel(QAbstractItemModel *model, QObject *parent /TransferThis/);
virtual ~QItemSelectionModel();
QModelIndex currentIndex() const;
bool isSelected(const QModelIndex &index) const;
bool isRowSelected(int row, const QModelIndex &parent = QModelIndex()) const;
bool isColumnSelected(int column, const QModelIndex &parent = QModelIndex()) const;
bool rowIntersectsSelection(int row, const QModelIndex &parent = QModelIndex()) const;
bool columnIntersectsSelection(int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndexList selectedIndexes() const;
const QItemSelection selection() const;
QAbstractItemModel *model();
public slots:
virtual void clear();
void clearSelection();
virtual void reset();
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void clearCurrentIndex();
signals:
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
void currentColumnChanged(const QModelIndex &current, const QModelIndex &previous);
protected:
void emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection);
public:
bool hasSelection() const;
QModelIndexList selectedRows(int column = 0) const;
QModelIndexList selectedColumns(int row = 0) const;
void setModel(QAbstractItemModel *model);
signals:
void modelChanged(QAbstractItemModel *model);
};
class QItemSelection
{
%TypeHeaderCode
#include <qitemselectionmodel.h>
%End
public:
QItemSelection();
QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void select(const QModelIndex &topLeft, const QModelIndex &bottomRight);
bool contains(const QModelIndex &index) const;
int __contains__(const QModelIndex &index);
%MethodCode
// It looks like you can't assign QBool to int.
sipRes = bool(sipCpp->contains(*a0));
%End
QModelIndexList indexes() const;
void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command);
static void split(const QItemSelectionRange &range, const QItemSelectionRange &other, QItemSelection *result);
void __setitem__(int i, const QItemSelectionRange &range);
%MethodCode
int len;
len = sipCpp->count();
if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
sipIsErr = 1;
else
(*sipCpp)[a0] = *a1;
%End
void __setitem__(SIP_PYSLICE slice, const QItemSelection &list);
%MethodCode
Py_ssize_t start, stop, step, slicelength;
if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0)
{
sipIsErr = 1;
}
else
{
int vlen = a1->count();
if (vlen != slicelength)
{
sipBadLengthForSlice(vlen, slicelength);
sipIsErr = 1;
}
else
{
QItemSelection::const_iterator it = a1->begin();
for (Py_ssize_t i = 0; i < slicelength; ++i)
{
(*sipCpp)[start] = *it;
start += step;
++it;
}
}
}
%End
void __delitem__(int i);
%MethodCode
if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0)
sipIsErr = 1;
else
sipCpp->removeAt(a0);
%End
void __delitem__(SIP_PYSLICE slice);
%MethodCode
Py_ssize_t start, stop, step, slicelength;
if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0)
{
sipIsErr = 1;
}
else
{
for (Py_ssize_t i = 0; i < slicelength; ++i)
{
sipCpp->removeAt(start);
start += step - 1;
}
}
%End
QItemSelectionRange operator[](int i);
%MethodCode
Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
if (idx < 0)
sipIsErr = 1;
else
sipRes = new QItemSelectionRange(sipCpp->operator[]((int)idx));
%End
QItemSelection operator[](SIP_PYSLICE slice);
%MethodCode
Py_ssize_t start, stop, step, slicelength;
if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0)
{
sipIsErr = 1;
}
else
{
sipRes = new QItemSelection();
for (Py_ssize_t i = 0; i < slicelength; ++i)
{
(*sipRes) += (*sipCpp)[start];
start += step;
}
}
%End
// Methods inherited from QList<QItemSelectionRange>.
bool operator!=(const QItemSelection &other) const;
bool operator==(const QItemSelection &other) const;
// Keep the following in sync with QStringList (except for mid()).
void clear();
bool isEmpty() const;
void append(const QItemSelectionRange &range);
void prepend(const QItemSelectionRange &range);
void insert(int i, const QItemSelectionRange &range);
void replace(int i, const QItemSelectionRange &range);
void removeAt(int i);
int removeAll(const QItemSelectionRange &range);
QItemSelectionRange takeAt(int i);
QItemSelectionRange takeFirst();
QItemSelectionRange takeLast();
void move(int from, int to);
int count(const QItemSelectionRange &range) const;
int count() const /__len__/;
QItemSelectionRange &first();
QItemSelectionRange &last();
int indexOf(const QItemSelectionRange &value, int from = 0) const;
int lastIndexOf(const QItemSelectionRange &value, int from = -1) const;
QItemSelection &operator+=(const QItemSelection &other);
QItemSelection &operator+=(const QItemSelectionRange &value);
};
%If (Qt_6_8_0 -)
bool operator!=(const QItemSelectionRange &lhs, const QItemSelectionRange &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QItemSelectionRange &lhs, const QItemSelectionRange &rhs);
%End
@@ -0,0 +1,129 @@
// This is the SIP interface definition for the QJsonArray mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// Note that we assume any iterable can be converted to a QJsonArray. However,
// because QJsonValue is an iterable and QJsonObject is implemented as a dict
// (which is also an iterable), then any overloads that handle one or more of
// them must be ordered so that QJsonArray is checked last.
%MappedType QJsonArray
/TypeHintIn="Iterable[QJsonValue]", TypeHintOut="List[QJsonValue]",
TypeHintValue="[]"/
{
%TypeHeaderCode
#include <qjsonarray.h>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New(sipCpp->size());
if (!l)
return 0;
for (int i = 0; i < sipCpp->size(); ++i)
{
QJsonValue *t = new QJsonValue(sipCpp->at(i));
PyObject *tobj = sipConvertFromNewType(t, sipType_QJsonValue,
sipTransferObj);
if (!tobj)
{
delete t;
Py_DECREF(l);
return 0;
}
PyList_SetItem(l, i, tobj);
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QJsonArray *ql = new QJsonArray;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete ql;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int state;
QJsonValue *t = reinterpret_cast<QJsonValue *>(
sipForceConvertToType(itm, sipType_QJsonValue, sipTransferObj,
SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but 'QJsonValue' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete ql;
Py_DECREF(iter);
return 0;
}
ql->append(*t);
sipReleaseType(t, sipType_QJsonValue, state);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = ql;
return sipGetState(sipTransferObj);
%End
};
@@ -0,0 +1,102 @@
// qjsondocument.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
struct QJsonParseError
{
%TypeHeaderCode
#include <qjsondocument.h>
%End
enum ParseError
{
NoError,
UnterminatedObject,
MissingNameSeparator,
UnterminatedArray,
MissingValueSeparator,
IllegalValue,
TerminationByNumber,
IllegalNumber,
IllegalEscapeSequence,
IllegalUTF8String,
UnterminatedString,
MissingObject,
DeepNesting,
DocumentTooLarge,
GarbageAtEnd,
};
QString errorString() const;
int offset;
QJsonParseError::ParseError error;
};
class QJsonDocument
{
%TypeHeaderCode
#include <qjsondocument.h>
%End
public:
QJsonDocument();
explicit QJsonDocument(const QJsonObject &object);
explicit QJsonDocument(const QJsonArray &array);
QJsonDocument(const QJsonDocument &other);
~QJsonDocument();
static QJsonDocument fromVariant(const QVariant &variant);
QVariant toVariant() const;
enum JsonFormat
{
Indented,
Compact,
};
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0);
QByteArray toJson(QJsonDocument::JsonFormat format = QJsonDocument::Indented) const;
bool isEmpty() const;
bool isArray() const;
bool isObject() const;
QJsonObject object() const;
QJsonArray array() const;
void setObject(const QJsonObject &object);
void setArray(const QJsonArray &array);
%If (- Qt_6_8_0)
bool operator==(const QJsonDocument &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QJsonDocument &other) const;
%End
bool isNull() const;
void swap(QJsonDocument &other /Constrained/);
const QJsonValue operator[](qsizetype i) const;
const QJsonValue operator[](const QString &key) const;
};
QDataStream &operator<<(QDataStream &, const QJsonDocument & /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QJsonDocument & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator!=(const QJsonDocument &lhs, const QJsonDocument &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QJsonDocument &lhs, const QJsonDocument &rhs);
%End
@@ -0,0 +1,136 @@
// This is the SIP interface definition for the QJsonObject mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%MappedType QJsonObject
/TypeHint="Dict[QString, QJsonValue]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qjsonobject.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QJsonObject::const_iterator it = sipCpp->constBegin();
QJsonObject::const_iterator end = sipCpp->constEnd();
while (it != end)
{
QString *k = new QString(it.key());
PyObject *kobj = sipConvertFromNewType(k, sipType_QString,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
return 0;
}
QJsonValue *v = new QJsonValue(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType_QJsonValue,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QJsonObject *jo = new QJsonObject;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int kstate;
QString *k = reinterpret_cast<QString *>(
sipForceConvertToType(kobj, sipType_QString, sipTransferObj,
SIP_NOT_NONE, &kstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a key has type '%s' but 'str' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete jo;
return 0;
}
int vstate;
QJsonValue *v = reinterpret_cast<QJsonValue *>(
sipForceConvertToType(vobj, sipType_QJsonValue, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a value has type '%s' but 'QJsonValue' is expected",
sipPyTypeName(Py_TYPE(vobj)));
sipReleaseType(k, sipType_QString, kstate);
delete jo;
return 0;
}
jo->insert(*k, *v);
sipReleaseType(v, sipType_QJsonValue, vstate);
sipReleaseType(k, sipType_QString, kstate);
}
*sipCppPtr = jo;
return sipGetState(sipTransferObj);
%End
};
@@ -0,0 +1,93 @@
// qjsonvalue.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QJsonValue /AllowNone,TypeHintIn="Union[QJsonValue, QJsonValue.Type, QJsonArray, QJsonObject, bool, int, float, None, QString]"/
{
%TypeHeaderCode
#include <qjsonvalue.h>
%End
%ConvertToTypeCode
if (!sipIsErr)
return qpycore_canConvertTo_QJsonValue(sipPy);
return qpycore_convertTo_QJsonValue(sipPy, sipTransferObj, sipCppPtr, sipIsErr);
%End
public:
enum Type
{
Null,
Bool,
Double,
String,
Array,
Object,
Undefined,
};
QJsonValue(QJsonValue::Type type /Constrained/ = QJsonValue::Null);
QJsonValue(const QJsonValue &other);
~QJsonValue();
static QJsonValue fromVariant(const QVariant &variant);
QVariant toVariant() const;
QJsonValue::Type type() const;
bool isNull() const;
bool isBool() const;
bool isDouble() const;
bool isString() const;
bool isArray() const;
bool isObject() const;
bool isUndefined() const;
bool toBool(bool defaultValue = false) const;
int toInt(int defaultValue = 0) const;
qint64 toInteger(qint64 defaultValue = 0) const;
double toDouble(double defaultValue = 0) const;
QJsonArray toArray() const;
QJsonArray toArray(const QJsonArray &defaultValue) const;
QJsonObject toObject() const;
QJsonObject toObject(const QJsonObject &defaultValue) const;
%If (- Qt_6_8_0)
bool operator==(const QJsonValue &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QJsonValue &other) const;
%End
QString toString() const;
QString toString(const QString &defaultValue) const;
void swap(QJsonValue &other /Constrained/);
const QJsonValue operator[](qsizetype i) const;
const QJsonValue operator[](const QString &key) const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
QDataStream &operator<<(QDataStream &, const QJsonValue & /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QJsonValue & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator==(const QJsonValue &lhs, const QJsonValue &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QJsonValue &lhs, const QJsonValue &rhs);
%End
@@ -0,0 +1,60 @@
// qlibrary.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QLibrary : public QObject
{
%TypeHeaderCode
#include <qlibrary.h>
%End
public:
enum LoadHint /BaseType=Flag/
{
ResolveAllSymbolsHint,
ExportExternalSymbolsHint,
LoadArchiveMemberHint,
PreventUnloadHint,
DeepBindHint,
};
typedef QFlags<QLibrary::LoadHint> LoadHints;
explicit QLibrary(QObject *parent /TransferThis/ = 0);
QLibrary(const QString &fileName, QObject *parent /TransferThis/ = 0);
QLibrary(const QString &fileName, int verNum, QObject *parent /TransferThis/ = 0);
QLibrary(const QString &fileName, const QString &version, QObject *parent /TransferThis/ = 0);
virtual ~QLibrary();
QString errorString() const;
QString fileName() const;
bool isLoaded() const;
bool load();
QLibrary::LoadHints loadHints() const;
QFunctionPointer resolve(const char *symbol);
static QFunctionPointer resolve(const QString &fileName, const char *symbol);
static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol);
static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol);
bool unload();
static bool isLibrary(const QString &fileName);
void setFileName(const QString &fileName);
void setFileNameAndVersion(const QString &fileName, int verNum);
void setFileNameAndVersion(const QString &fileName, const QString &version);
void setLoadHints(QLibrary::LoadHints hints);
};
@@ -0,0 +1,63 @@
// qlibraryinfo.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QLibraryInfo
{
%TypeHeaderCode
#include <qlibraryinfo.h>
%End
public:
enum LibraryPath
{
PrefixPath,
DocumentationPath,
HeadersPath,
LibrariesPath,
LibraryExecutablesPath,
BinariesPath,
PluginsPath,
Qml2ImportsPath,
ArchDataPath,
DataPath,
TranslationsPath,
ExamplesPath,
TestsPath,
SettingsPath,
%If (Qt_6_2_0 -)
QmlImportsPath,
%End
};
static bool isDebugBuild();
%If (Qt_6_5_0 -)
static bool isSharedBuild();
%End
static QString path(QLibraryInfo::LibraryPath p) /ReleaseGIL/;
static QVersionNumber version();
%If (Qt_6_8_0 -)
static QStringList paths(QLibraryInfo::LibraryPath p) /ReleaseGIL/;
%End
private:
QLibraryInfo();
};
@@ -0,0 +1,213 @@
// qline.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qline.h>
%End
class QLine
{
%TypeHeaderCode
#include <qline.h>
%End
%PickleCode
sipRes = Py_BuildValue("iiii", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2());
%End
public:
QLine();
QLine(const QPoint &pt1_, const QPoint &pt2_);
QLine(int x1pos, int y1pos, int x2pos, int y2pos);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QLine()");
}
else
{
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QLine(%i, %i, %i, %i)",
sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2());
}
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
int x1() const;
int y1() const;
int x2() const;
int y2() const;
QPoint p1() const;
QPoint p2() const;
int dx() const;
int dy() const;
void translate(const QPoint &point);
void translate(int adx, int ady);
%If (- Qt_6_8_0)
bool operator==(const QLine &d) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QLine &d) const;
%End
QLine translated(const QPoint &p) const;
QLine translated(int adx, int ady) const;
void setP1(const QPoint &aP1);
void setP2(const QPoint &aP2);
void setPoints(const QPoint &aP1, const QPoint &aP2);
void setLine(int aX1, int aY1, int aX2, int aY2);
QPoint center() const;
%If (Qt_6_4_0 -)
QLineF toLineF() const;
%End
};
QDataStream &operator<<(QDataStream &, const QLine &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QLine & /Constrained/) /ReleaseGIL/;
class QLineF
{
%TypeHeaderCode
#include <qline.h>
%End
%PickleCode
sipRes = Py_BuildValue("dddd", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2());
%End
public:
enum IntersectionType
{
NoIntersection,
BoundedIntersection,
UnboundedIntersection,
};
QLineF(const QLine &line);
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
qreal length() const;
QLineF unitVector() const;
QLineF::IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint /Out/ = 0) const;
QLineF();
QLineF(const QPointF &apt1, const QPointF &apt2);
QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QLineF()");
}
else
{
PyObject *x1 = PyFloat_FromDouble(sipCpp->x1());
PyObject *y1 = PyFloat_FromDouble(sipCpp->y1());
PyObject *x2 = PyFloat_FromDouble(sipCpp->x2());
PyObject *y2 = PyFloat_FromDouble(sipCpp->y2());
if (x1 && y1 && x2 && y2)
{
sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QLineF(%R, %R, %R, %R)",
x1, y1, x2, y2);
}
Py_XDECREF(x1);
Py_XDECREF(y1);
Py_XDECREF(x2);
Py_XDECREF(y2);
}
%End
qreal x1() const;
qreal y1() const;
qreal x2() const;
qreal y2() const;
QPointF p1() const;
QPointF p2() const;
qreal dx() const;
qreal dy() const;
QLineF normalVector() const;
void translate(const QPointF &point);
void translate(qreal adx, qreal ady);
void setLength(qreal len);
QPointF pointAt(qreal t) const;
QLine toLine() const;
%If (- Qt_6_8_0)
bool operator==(const QLineF &d) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QLineF &d) const;
%End
static QLineF fromPolar(qreal length, qreal angle);
qreal angle() const;
void setAngle(qreal angle);
qreal angleTo(const QLineF &l) const;
QLineF translated(const QPointF &p) const;
QLineF translated(qreal adx, qreal ady) const;
void setP1(const QPointF &aP1);
void setP2(const QPointF &aP2);
void setPoints(const QPointF &aP1, const QPointF &aP2);
void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2);
QPointF center() const;
};
QDataStream &operator<<(QDataStream &, const QLineF &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QLineF & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator!=(const QLineF &lhs, const QLine &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QLine &lhs, const QLineF &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QLineF &lhs, const QLineF &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QLine &lhs, const QLine &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QLineF &lhs, const QLine &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QLine &lhs, const QLineF &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QLineF &lhs, const QLineF &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QLine &lhs, const QLine &rhs);
%End
%If (Qt_6_8_0 -)
bool qFuzzyCompare(const QLineF &lhs, const QLineF &rhs);
%End
%If (Qt_6_8_0 -)
bool qFuzzyIsNull(const QLineF &line);
%End
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,54 @@
// qlockfile.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QLockFile
{
%TypeHeaderCode
#include <qlockfile.h>
%End
public:
QLockFile(const QString &fileName);
~QLockFile();
bool lock() /ReleaseGIL/;
bool tryLock(int timeout = 0) /ReleaseGIL/;
void unlock() /ReleaseGIL/;
void setStaleLockTime(int);
int staleLockTime() const;
bool isLocked() const /ReleaseGIL/;
bool getLockInfo(qint64 *pid /Out/, QString *hostname /Out/, QString *appname /Out/) const;
bool removeStaleLockFile() /ReleaseGIL/;
enum LockError
{
NoError,
LockFailedError,
PermissionError,
UnknownError,
};
QLockFile::LockError error() const;
QString fileName() const;
private:
QLockFile(const QLockFile &);
};
@@ -0,0 +1,236 @@
// qlogging.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qlogging.h>
%End
enum QtMsgType
{
QtDebugMsg,
QtWarningMsg,
QtCriticalMsg,
QtFatalMsg,
QtSystemMsg,
QtInfoMsg,
};
class QMessageLogContext /NoDefaultCtors/
{
%TypeHeaderCode
#include <qlogging.h>
%End
public:
%If (Qt_6_8_0 -)
static const int CurrentVersion;
%End
int line;
const char *file;
const char *function;
const char *category;
};
class QMessageLogger
{
%TypeHeaderCode
#include <qlogging.h>
%End
public:
QMessageLogger();
QMessageLogger(const char *file, int line, const char *function);
QMessageLogger(const char *file, int line, const char *function, const char *category);
void debug(const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->debug("%s", a0);
Py_END_ALLOW_THREADS
%End
void debug(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->debug(*a0, "%s", a1);
Py_END_ALLOW_THREADS
%End
void info(const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->info("%s", a0);
Py_END_ALLOW_THREADS
%End
void info(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->info(*a0, "%s", a1);
Py_END_ALLOW_THREADS
%End
void warning(const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->warning("%s", a0);
Py_END_ALLOW_THREADS
%End
void warning(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->warning(*a0, "%s", a1);
Py_END_ALLOW_THREADS
%End
void critical(const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->critical("%s", a0);
Py_END_ALLOW_THREADS
%End
void critical(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->critical(*a0, "%s", a1);
Py_END_ALLOW_THREADS
%End
void fatal(const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->fatal("%s", a0);
Py_END_ALLOW_THREADS
%End
%If (Qt_6_5_0 -)
void fatal(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp->fatal(*a0, "%s", a1);
Py_END_ALLOW_THREADS
%End
%End
private:
QMessageLogger(const QMessageLogger &);
};
void qCritical(const char *msg) /ReleaseGIL/;
%MethodCode
const char *file, *function;
int line = qpycore_current_context(&file, &function);
Py_BEGIN_ALLOW_THREADS
QMessageLogger(file, line, function).critical("%s", a0);
Py_END_ALLOW_THREADS
%End
void qDebug(const char *msg) /ReleaseGIL/;
%MethodCode
const char *file, *function;
int line = qpycore_current_context(&file, &function);
Py_BEGIN_ALLOW_THREADS
QMessageLogger(file, line, function).debug("%s", a0);
Py_END_ALLOW_THREADS
%End
void qFatal(const char *msg) /ReleaseGIL/;
%MethodCode
const char *file, *function;
int line = qpycore_current_context(&file, &function);
Py_BEGIN_ALLOW_THREADS
QMessageLogger(file, line, function).fatal("%s", a0);
Py_END_ALLOW_THREADS
%End
void qInfo(const char *msg) /ReleaseGIL/;
%MethodCode
const char *file, *function;
int line = qpycore_current_context(&file, &function);
Py_BEGIN_ALLOW_THREADS
QMessageLogger(file, line, function).info("%s", a0);
Py_END_ALLOW_THREADS
%End
void qWarning(const char *msg) /ReleaseGIL/;
%MethodCode
const char *file, *function;
int line = qpycore_current_context(&file, &function);
Py_BEGIN_ALLOW_THREADS
QMessageLogger(file, line, function).warning("%s", a0);
Py_END_ALLOW_THREADS
%End
SIP_PYCALLABLE qInstallMessageHandler(SIP_PYCALLABLE /AllowNone,TypeHint="Optional[Callable[[QtMsgType, QMessageLogContext, QString], None]]"/) /TypeHint="Optional[Callable[[QtMsgType, QMessageLogContext, QString], None]]"/;
%MethodCode
// Treat None as the default handler.
QtMessageHandler old = qInstallMessageHandler((a0 != Py_None) ? qtcore_MessageHandler : 0);
// If we recognise the old handler, then return it. Otherwise return
// the default handler. This doesn't exactly mimic the Qt behaviour
// but it is probably close enough for the way it will be used.
sipRes = (old == qtcore_MessageHandler) ? qtcore_PyMessageHandler : Py_None;
Py_INCREF(sipRes);
// Save the new Python handler.
Py_XDECREF(qtcore_PyMessageHandler);
qtcore_PyMessageHandler = a0;
Py_INCREF(qtcore_PyMessageHandler);
%End
// Module code needed by qInstallMessageHandler().
%ModuleCode
// The user supplied Python handler.
static PyObject *qtcore_PyMessageHandler = 0;
// The C++ wrapper around the Python handler.
static void qtcore_MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
PyObject *res;
SIP_BLOCK_THREADS
res = sipCallMethod(0, qtcore_PyMessageHandler, "FDD", type, sipType_QtMsgType, &context, sipType_QMessageLogContext, NULL, &msg, sipType_QString, NULL);
Py_XDECREF(res);
if (res != NULL && res != Py_None)
{
PyErr_SetString(PyExc_TypeError, "invalid result type from PyQt message handler");
res = NULL;
}
if (res == NULL)
pyqt6_err_print();
SIP_UNBLOCK_THREADS
}
%End
void qSetMessagePattern(const QString &messagePattern);
QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &buf);
@@ -0,0 +1,45 @@
// qloggingcategory.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QLoggingCategory
{
%TypeHeaderCode
#include <qloggingcategory.h>
%End
public:
QLoggingCategory(const char *category, QtMsgType severityLevel = QtDebugMsg);
~QLoggingCategory();
bool isEnabled(QtMsgType type) const;
void setEnabled(QtMsgType type, bool enable);
bool isDebugEnabled() const;
bool isInfoEnabled() const;
bool isWarningEnabled() const;
bool isCriticalEnabled() const;
const char *categoryName() const;
QLoggingCategory &operator()();
static QLoggingCategory *defaultCategory();
static void setFilterRules(const QString &rules);
private:
QLoggingCategory(const QLoggingCategory &);
};
@@ -0,0 +1,135 @@
// qmargins.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qmargins.h>
%End
class QMargins
{
%TypeHeaderCode
#include <qmargins.h>
%End
public:
QMargins();
QMargins(int aleft, int atop, int aright, int abottom);
bool isNull() const;
int left() const;
int top() const;
int right() const;
int bottom() const;
void setLeft(int aleft);
void setTop(int atop);
void setRight(int aright);
void setBottom(int abottom);
QMargins &operator+=(const QMargins &margins);
QMargins &operator-=(const QMargins &margins);
QMargins &operator*=(int factor /Constrained/);
QMargins &operator/=(int divisor /Constrained/);
QMargins &operator*=(qreal factor);
QMargins &operator/=(qreal divisor);
QMargins &operator+=(int margin);
QMargins &operator-=(int margin);
%If (Qt_6_4_0 -)
QMarginsF toMarginsF() const;
%End
};
%If (Qt_6_8_0 -)
bool operator==(const QMarginsF &lhs, const QMargins &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QMargins &lhs, const QMarginsF &rhs);
%End
bool operator==(const QMargins &m1, const QMargins &m2);
%If (Qt_6_8_0 -)
bool operator!=(const QMarginsF &lhs, const QMargins &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QMargins &lhs, const QMarginsF &rhs);
%End
bool operator!=(const QMargins &m1, const QMargins &m2);
QDataStream &operator<<(QDataStream &, const QMargins & /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QMargins & /Constrained/) /ReleaseGIL/;
QMargins operator+(const QMargins &m1, const QMargins &m2);
QMargins operator-(const QMargins &m1, const QMargins &m2);
QMargins operator*(const QMargins &margins, int factor /Constrained/);
QMargins operator*(const QMargins &margins, qreal factor);
QMargins operator/(const QMargins &margins, int divisor /Constrained/);
QMargins operator/(const QMargins &margins, qreal divisor);
QMargins operator+(const QMargins &lhs, int rhs);
QMargins operator+(int lhs, const QMargins &rhs);
QMargins operator-(const QMargins &lhs, int rhs);
QMargins operator+(const QMargins &margins);
QMargins operator-(const QMargins &margins);
QMargins operator|(const QMargins &m1, const QMargins &m2);
class QMarginsF
{
%TypeHeaderCode
#include <qmargins.h>
%End
public:
QMarginsF();
QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom);
QMarginsF(const QMargins &margins);
bool isNull() const;
qreal left() const;
qreal top() const;
qreal right() const;
qreal bottom() const;
void setLeft(qreal aleft);
void setTop(qreal atop);
void setRight(qreal aright);
void setBottom(qreal abottom);
QMarginsF &operator+=(const QMarginsF &margins);
QMarginsF &operator-=(const QMarginsF &margins);
QMarginsF &operator+=(qreal addend);
QMarginsF &operator-=(qreal subtrahend);
QMarginsF &operator*=(qreal factor);
QMarginsF &operator/=(qreal divisor);
QMargins toMargins() const;
};
QDataStream &operator<<(QDataStream &, const QMarginsF & /Constrained/);
QDataStream &operator>>(QDataStream &, QMarginsF & /Constrained/);
bool operator==(const QMarginsF &lhs, const QMarginsF &rhs);
bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs);
QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs);
QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs);
QMarginsF operator+(const QMarginsF &lhs, qreal rhs);
QMarginsF operator+(qreal lhs, const QMarginsF &rhs);
QMarginsF operator-(const QMarginsF &lhs, qreal rhs);
QMarginsF operator*(const QMarginsF &lhs, qreal rhs);
QMarginsF operator*(qreal lhs, const QMarginsF &rhs);
QMarginsF operator/(const QMarginsF &lhs, qreal divisor);
QMarginsF operator+(const QMarginsF &margins);
QMarginsF operator-(const QMarginsF &margins);
QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2);
%If (Qt_6_8_0 -)
bool qFuzzyCompare(const QMarginsF &lhs, const QMarginsF &rhs);
%End
%If (Qt_6_8_0 -)
bool qFuzzyIsNull(const QMarginsF &m);
%End
@@ -0,0 +1,78 @@
// qmessageauthenticationcode.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMessageAuthenticationCode
{
%TypeHeaderCode
#include <qmessageauthenticationcode.h>
%End
public:
%If (Qt_6_6_0 -)
QMessageAuthenticationCode(QCryptographicHash::Algorithm method, QByteArrayView key = {});
%End
%If (- Qt_6_6_0)
QMessageAuthenticationCode(QCryptographicHash::Algorithm method, const QByteArray &key = QByteArray());
%End
~QMessageAuthenticationCode();
void reset();
%If (Qt_6_6_0 -)
void setKey(QByteArrayView key);
%End
%If (- Qt_6_6_0)
void setKey(const QByteArray &key);
%End
%If (Qt_6_6_0 -)
void addData(QByteArrayView data);
%End
%If (- Qt_6_6_0)
void addData(SIP_PYBUFFER);
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
sipCpp->addData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
%End
bool addData(QIODevice *device);
QByteArray result() const;
%If (Qt_6_6_0 -)
static QByteArray hash(QByteArrayView message, QByteArrayView key, QCryptographicHash::Algorithm method);
%End
%If (- Qt_6_6_0)
static QByteArray hash(const QByteArray &message, const QByteArray &key, QCryptographicHash::Algorithm method);
%End
%If (Qt_6_6_0 -)
void swap(QMessageAuthenticationCode &other /Constrained/);
%End
private:
QMessageAuthenticationCode(const QMessageAuthenticationCode &);
};
@@ -0,0 +1,275 @@
// qmetaobject.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMetaMethod
{
%TypeHeaderCode
#include <qmetaobject.h>
%End
%TypeCode
// Raise an exception when QMetaMethod::invoke() returns false.
static void qtcore_invoke_exception()
{
PyErr_SetString(PyExc_RuntimeError, "QMetaMethod.invoke() call failed");
}
%End
public:
QMetaMethod();
const char *typeName() const;
QList<QByteArray> parameterTypes() const;
QList<QByteArray> parameterNames() const;
const char *tag() const;
enum Access
{
Private,
Protected,
Public,
};
QMetaMethod::Access access() const;
enum MethodType
{
Method,
Signal,
Slot,
Constructor,
};
QMetaMethod::MethodType methodType() const;
SIP_PYOBJECT invoke(QObject *object, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10);
Py_END_ALLOW_THREADS
if (ok)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
qtcore_invoke_exception();
}
%End
SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11);
Py_END_ALLOW_THREADS
if (ok)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
qtcore_invoke_exception();
}
%End
SIP_PYOBJECT invoke(QObject *object, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10,
*a11);
Py_END_ALLOW_THREADS
if (ok)
sipRes = qpycore_ReturnValue(a1Wrapper);
else
qtcore_invoke_exception();
%End
SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11,
*a12);
Py_END_ALLOW_THREADS
if (ok)
sipRes = qpycore_ReturnValue(a2Wrapper);
else
qtcore_invoke_exception();
%End
int methodIndex() const;
int revision() const;
bool isValid() const;
QByteArray methodSignature() const;
QByteArray name() const;
int returnType() const;
int parameterCount() const;
int parameterType(int index) const;
QMetaType returnMetaType() const;
QMetaType parameterMetaType(int index) const;
QByteArray parameterTypeName(int index) const;
int relativeMethodIndex() const;
%If (Qt_6_2_0 -)
bool isConst() const;
%End
};
class QMetaEnum
{
%TypeHeaderCode
#include <qmetaobject.h>
%End
public:
QMetaEnum();
const char *name() const;
bool isFlag() const;
int keyCount() const;
const char *key(int index) const;
int value(int index) const;
const char *scope() const;
int keyToValue(const char *key, bool *ok = 0) const;
const char *valueToKey(int value) const;
int keysToValue(const char *keys, bool *ok = 0) const;
QByteArray valueToKeys(int value) const;
bool isValid() const;
bool isScoped() const;
const char *enumName() const;
%If (Qt_6_6_0 -)
QMetaType metaType() const;
%End
};
class QMetaProperty
{
%TypeHeaderCode
#include <qmetaobject.h>
%End
public:
QMetaProperty();
const char *name() const;
const char *typeName() const;
bool isReadable() const;
bool isWritable() const;
bool isDesignable() const;
bool isScriptable() const;
bool isStored() const;
bool isFlagType() const;
bool isEnumType() const;
QMetaEnum enumerator() const;
SIP_PYOBJECT read(const QObject *obj) const /TypeHint="Any"/;
%MethodCode
// Make use of the QMetaProperty to provide the extra information to correctly
// handle enums.
sipRes = qpycore_PyObject_FromQVariant(*sipCpp, sipCpp->read(a0));
%End
bool write(QObject *obj, const QVariant &value) const;
%MethodCode
// If it looks like we are trying to write an int to an enum then we are
// probably trying to write to an unregistered enum. Converting the int to the
// name of the corresponding key should work (although this isn't a documented
// feature).
QMetaEnum me = sipCpp->enumerator();
if (me.isValid() && a1->typeId() == QMetaType::Int)
{
QString key;
if (me.isFlag())
{
key = QString(me.valueToKeys(a1->toInt()));
}
else
{
const char *key_s = me.valueToKey(a1->toInt());
if (key_s)
{
key = QString(key_s);
}
else
{
PyErr_Format(PyExc_ValueError, "%S is not a valid enum member", a1);
sipIsErr = 1;
}
}
if (!sipIsErr)
*const_cast<QVariant *>(a1) = QVariant(key);
}
if (!sipIsErr)
sipRes = sipCpp->write(a0, *a1);
%End
bool reset(QObject *obj) const;
bool hasStdCppSet() const;
bool isValid() const;
bool isResettable() const;
bool isUser() const;
int userType() const;
bool hasNotifySignal() const;
QMetaMethod notifySignal() const;
int notifySignalIndex() const;
int propertyIndex() const;
bool isConstant() const;
bool isFinal() const;
int revision() const;
int relativePropertyIndex() const;
bool isRequired() const;
QMetaType metaType() const;
bool isBindable() const;
int typeId() const;
};
class QMetaClassInfo
{
%TypeHeaderCode
#include <qmetaobject.h>
%End
public:
QMetaClassInfo();
const char *name() const;
const char *value() const;
};
bool operator==(const QMetaMethod &m1, const QMetaMethod &m2);
bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2);
@@ -0,0 +1,204 @@
// qmetatype.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMetaType
{
%TypeHeaderCode
#include <qmetatype.h>
%End
public:
enum Type
{
UnknownType,
Void,
Bool,
Int,
UInt,
LongLong,
ULongLong,
Double,
QChar,
QVariantMap,
QVariantList,
QVariantHash,
QString,
QStringList,
QByteArray,
QBitArray,
QDate,
QTime,
QDateTime,
QUrl,
QLocale,
QRect,
QRectF,
QSize,
QSizeF,
QLine,
QLineF,
QPoint,
QPointF,
LastCoreType,
FirstGuiType,
QFont,
QPixmap,
QBrush,
QColor,
QPalette,
QIcon,
QImage,
QPolygon,
QRegion,
QBitmap,
QCursor,
QSizePolicy,
QKeySequence,
QPen,
QTextLength,
QTextFormat,
QTransform,
VoidStar,
Long,
Short,
Char,
Char16,
Char32,
ULong,
UShort,
UChar,
Float,
%If (Qt_6_5_0 -)
Float16,
%End
QObjectStar,
QMatrix4x4,
QVector2D,
QVector3D,
QVector4D,
QQuaternion,
QEasingCurve,
QVariant,
QUuid,
QModelIndex,
QPolygonF,
SChar,
QRegularExpression,
QJsonValue,
QJsonObject,
QJsonArray,
QJsonDocument,
QByteArrayList,
QPersistentModelIndex,
QCborSimpleType,
QCborValue,
QCborArray,
QCborMap,
QColorSpace,
QVariantPair,
User,
};
static bool isRegistered(int type);
QMetaType();
explicit QMetaType(int type);
enum TypeFlag /BaseType=Flag/
{
NeedsConstruction,
NeedsDestruction,
PointerToQObject,
IsEnumeration,
IsUnsignedEnumeration,
IsPointer,
RelocatableType,
IsQmlList,
%If (Qt_6_2_0 -)
IsConst,
%End
%If (Qt_6_5_0 -)
NeedsCopyConstruction,
%End
%If (Qt_6_5_0 -)
NeedsMoveConstruction,
%End
};
typedef QFlags<QMetaType::TypeFlag> TypeFlags;
qsizetype sizeOf() const;
QMetaType::TypeFlags flags() const;
bool isValid() const;
bool isRegistered() const;
int id() const;
%If (Qt_6_1_0 -)
bool hasRegisteredDataStreamOperators() const;
%End
bool hasRegisteredDebugStreamOperator() const;
const char *name() const /Encoding="None"/;
qsizetype alignOf() const;
bool isEqualityComparable() const;
bool isOrdered() const;
static QMetaType fromName(QByteArrayView name);
static bool canConvert(QMetaType fromType, QMetaType toType);
static bool canView(QMetaType fromType, QMetaType toType);
%If (Qt_6_4_0 -)
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
%End
%If (Qt_6_5_0 -)
void registerType() const;
%End
%If (Qt_6_5_0 -)
bool isDefaultConstructible() const;
%End
%If (Qt_6_5_0 -)
bool isCopyConstructible() const;
%End
%If (Qt_6_5_0 -)
bool isMoveConstructible() const;
%End
%If (Qt_6_5_0 -)
bool isDestructible() const;
%End
%If (Qt_6_6_0 -)
QMetaType underlyingType() const;
%End
private:
QMetaType(const QMetaType &);
};
%If (Qt_6_8_0 -)
bool operator==(const QMetaType &lhs, const QMetaType &rhs);
%End
%If (- Qt_6_8_0)
bool operator==(QMetaType a, QMetaType b);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QMetaType &lhs, const QMetaType &rhs);
%End
%If (- Qt_6_8_0)
bool operator!=(QMetaType a, QMetaType b);
%End
@@ -0,0 +1,56 @@
// qmimedata.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMimeData : public QObject
{
%TypeHeaderCode
#include <qmimedata.h>
%End
public:
QMimeData();
virtual ~QMimeData();
QList<QUrl> urls() const;
void setUrls(const QList<QUrl> &urls);
bool hasUrls() const;
QString text() const;
void setText(const QString &text);
bool hasText() const;
QString html() const;
void setHtml(const QString &html);
bool hasHtml() const;
QVariant imageData() const;
void setImageData(const QVariant &image);
bool hasImage() const;
QVariant colorData() const;
void setColorData(const QVariant &color);
bool hasColor() const;
QByteArray data(const QString &mimetype) const;
void setData(const QString &mimetype, const QByteArray &data);
virtual bool hasFormat(const QString &mimetype) const;
virtual QStringList formats() const;
void clear();
void removeFormat(const QString &mimetype);
protected:
virtual QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const;
};
@@ -0,0 +1,54 @@
// qmimedatabase.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMimeDatabase
{
%TypeHeaderCode
#include <qmimedatabase.h>
%End
public:
QMimeDatabase();
~QMimeDatabase();
QMimeType mimeTypeForName(const QString &nameOrAlias) const;
enum MatchMode
{
MatchDefault,
MatchExtension,
MatchContent,
};
QMimeType mimeTypeForFile(const QString &fileName, QMimeDatabase::MatchMode mode = QMimeDatabase::MatchDefault) const;
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, QMimeDatabase::MatchMode mode = QMimeDatabase::MatchDefault) const;
QList<QMimeType> mimeTypesForFileName(const QString &fileName) const;
QMimeType mimeTypeForData(const QByteArray &data) const;
QMimeType mimeTypeForData(QIODevice *device) const;
QMimeType mimeTypeForUrl(const QUrl &url) const;
QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const;
QMimeType mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const;
QString suffixForFileName(const QString &fileName) const;
QList<QMimeType> allMimeTypes() const;
private:
QMimeDatabase(const QMimeDatabase &);
};
@@ -0,0 +1,65 @@
// qmimetype.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMimeType
{
%TypeHeaderCode
#include <qmimetype.h>
%End
public:
QMimeType();
QMimeType(const QMimeType &other);
~QMimeType();
void swap(QMimeType &other /Constrained/);
%If (- Qt_6_8_0)
bool operator==(const QMimeType &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QMimeType &other) const;
%End
bool isValid() const;
bool isDefault() const;
QString name() const;
QString comment() const;
QString genericIconName() const;
QString iconName() const;
QStringList globPatterns() const;
QStringList parentMimeTypes() const;
QStringList allAncestors() const;
QStringList aliases() const;
QStringList suffixes() const;
QString preferredSuffix() const;
bool inherits(const QString &mimeTypeName) const;
QString filterString() const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
};
%If (Qt_6_8_0 -)
bool operator!=(const QMimeType &lhs, const QMimeType &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QMimeType &lhs, const QMimeType &rhs);
%End
@@ -0,0 +1,63 @@
// qmutex.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QMutex
{
%TypeHeaderCode
#include <qmutex.h>
%End
public:
QMutex();
~QMutex();
// Methods from QBasicMutex.
void lock() /ReleaseGIL/;
bool tryLock() /ReleaseGIL/;
void unlock() /ReleaseGIL/;
%If (Qt_6_6_0 -)
bool tryLock(QDeadlineTimer timeout) /ReleaseGIL/;
%End
bool tryLock(int timeout) /ReleaseGIL/;
private:
QMutex(const QMutex &);
};
class QRecursiveMutex
{
%TypeHeaderCode
#include <qmutex.h>
%End
public:
QRecursiveMutex();
~QRecursiveMutex();
void lock() /ReleaseGIL/;
%If (Qt_6_6_0 -)
bool tryLock(QDeadlineTimer) /ReleaseGIL/ [bool (QDeadlineTimer timer = {})];
%End
bool tryLock(int timeout = 0) /ReleaseGIL/;
void unlock() /ReleaseGIL/;
private:
QRecursiveMutex(const QRecursiveMutex &);
};
@@ -0,0 +1,65 @@
// This is the SIP interface definition for the QMutexLocker class.
//
// In Qt6 this is a template so we wrap our own class that implements the Qt5
// API.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class PyQtMutexLocker /PyName=QMutexLocker/
{
%TypeHeaderCode
#include "qpycore_pyqtmutexlocker.h"
%End
public:
PyQtMutexLocker(QMutex *mutex /GetWrapper/) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp = new PyQtMutexLocker(a0, a0Wrapper);
Py_END_ALLOW_THREADS
%End
PyQtMutexLocker(QRecursiveMutex *mutex /GetWrapper/) /ReleaseGIL/;
%MethodCode
Py_BEGIN_ALLOW_THREADS
sipCpp = new PyQtMutexLocker(a0, a0Wrapper);
Py_END_ALLOW_THREADS
%End
~PyQtMutexLocker();
SIP_PYOBJECT mutex() /TypeHint="Union[QMutex, QRecursiveMutex]"/;
void unlock() /ReleaseGIL/;
void relock() /ReleaseGIL/;
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
sipCpp->unlock();
%End
private:
PyQtMutexLocker(const PyQtMutexLocker &);
};
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,48 @@
// qnumeric.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qnumeric.h>
%End
bool qIsInf(double d);
bool qIsFinite(double d);
bool qIsNaN(double d);
double qInf();
double qSNaN();
double qQNaN();
quint64 qFloatDistance(double a, double b);
%If (Qt_6_5_0 -)
double qAbs(const double &t);
%End
%If (Qt_6_5_0 -)
int qRound(double d);
%End
%If (Qt_6_5_0 -)
qint64 qRound64(double d);
%End
%If (Qt_6_5_0 -)
bool qFuzzyCompare(double p1, double p2);
%End
%If (Qt_6_5_0 -)
bool qFuzzyIsNull(double d);
%End
@@ -0,0 +1,627 @@
// qobject.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
typedef QList<QObject *> QObjectList;
class QObject /Supertype=PyQt6.sip.wrapper/
{
%TypeHeaderCode
#include <qobject.h>
%End
%TypeCode
// This is needed by the tr() handwritten implementation.
#include <qcoreapplication.h>
// These are the helper functions for QObject::findChild() and
// QObject::findChildren.
// Wrap the given type in a 1-tuple.
static PyObject *qtcore_type_to_tuple(PyObject *type)
{
PyObject *tuple = PyTuple_New(1);
if (tuple)
{
Py_INCREF(type);
PyTuple_SetItem(tuple, 0, type);
}
return tuple;
}
// Check all elements of a given tuple are type objects and return a new
// reference to the tuple if so.
static PyObject *qtcore_check_tuple_types(PyObject *types)
{
for (Py_ssize_t i = 0; i < PyTuple_Size(types); ++i)
if (!PyObject_TypeCheck(PyTuple_GetItem(types, i), &PyType_Type))
{
PyErr_SetString(PyExc_TypeError,
"all elements of the types argument must be type objects");
return 0;
}
Py_INCREF(types);
return types;
}
// Do the main work of finding a child.
static PyObject *qtcore_do_find_child(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
{
const QObjectList &children = parent->children();
int i;
for (i = 0; i < children.size(); ++i)
{
QObject *obj = children.at(i);
PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
if (!pyo)
return 0;
// Allow for proxies.
QObject *resolved = reinterpret_cast<QObject *>(sipGetAddress((sipSimpleWrapper *)pyo));
if (name.isNull() || resolved->objectName() == name)
for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
return pyo;
Py_DECREF(pyo);
}
if (options == Qt::FindChildrenRecursively)
for (i = 0; i < children.size(); ++i)
{
PyObject *pyo = qtcore_do_find_child(children.at(i), types, name, options);
if (pyo != Py_None)
return pyo;
Py_DECREF(pyo);
}
Py_INCREF(Py_None);
return Py_None;
}
// Find a child that is one of a number of types and with an optional name.
static PyObject *qtcore_FindChild(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
{
// Check that the types checking was successful.
if (!types)
return 0;
PyObject *child = qtcore_do_find_child(parent, types, name, options);
Py_DECREF(types);
return child;
}
// Do the main work of finding the children with a string name.
static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options, PyObject *list)
{
const QObjectList &children = parent->children();
int i;
for (i = 0; i < children.size(); ++i)
{
QObject *obj = children.at(i);
PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
if (!pyo)
return false;
// Allow for proxies.
QObject *resolved = reinterpret_cast<QObject *>(sipGetAddress((sipSimpleWrapper *)pyo));
if (name.isNull() || resolved->objectName() == name)
for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
if (PyList_Append(list, pyo) < 0)
{
Py_DECREF(pyo);
return false;
}
Py_DECREF(pyo);
if (options == Qt::FindChildrenRecursively)
{
bool ok = qtcore_do_find_children(obj, types, name, options, list);
if (!ok)
return false;
}
}
return true;
}
// Find a child that is one of a number of types and with an optional string
// name.
static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
{
// Check that the types checking was successful.
if (!types)
return 0;
PyObject *list = PyList_New(0);
if (list)
if (!qtcore_do_find_children(parent, types, name, options, list))
Py_DECREF(list);
Py_DECREF(types);
return list;
}
// Do the main work of finding the children with a QRegularExpression name.
static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options, PyObject *list)
{
const QObjectList &children = parent->children();
int i;
for (i = 0; i < children.size(); ++i)
{
QObject *obj = children.at(i);
PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
if (!pyo)
return false;
QRegularExpressionMatch m = re.match(obj->objectName());
if (m.hasMatch())
for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
if (PyList_Append(list, pyo) < 0)
{
Py_DECREF(pyo);
return false;
}
Py_DECREF(pyo);
if (options == Qt::FindChildrenRecursively)
{
bool ok = qtcore_do_find_children(obj, types, re, options, list);
if (!ok)
return false;
}
}
return true;
}
// Find a child that is one of a number of types and with an optional
// QRegularExpression name.
static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options)
{
// Check that the types checking was successful.
if (!types)
return 0;
PyObject *list = PyList_New(0);
if (list)
if (!qtcore_do_find_children(parent, types, re, options, list))
Py_DECREF(list);
Py_DECREF(types);
return list;
}
%End
%FinalisationCode
return qpycore_qobject_finalisation(sipSelf, sipCpp, sipKwds, sipUnused);
%End
%ConvertToSubClassCode
static struct class_graph {
const char *name;
sipTypeDef **type;
int yes, no;
} graph[] = {
{sipName_QAbstractAnimation, &sipType_QAbstractAnimation, 23, 1},
{sipName_QAbstractEventDispatcher, &sipType_QAbstractEventDispatcher, -1, 2},
{sipName_QAbstractItemModel, &sipType_QAbstractItemModel, 29, 3},
{sipName_QIODevice, &sipType_QIODevice, 37, 4},
{sipName_QCoreApplication, &sipType_QCoreApplication, -1, 5},
{sipName_QEventLoop, &sipType_QEventLoop, -1, 6},
{sipName_QFileSelector, &sipType_QFileSelector, -1, 7},
{sipName_QFileSystemWatcher, &sipType_QFileSystemWatcher, -1, 8},
{sipName_QItemSelectionModel, &sipType_QItemSelectionModel, -1, 9},
{sipName_QLibrary, &sipType_QLibrary, -1, 10},
{sipName_QMimeData, &sipType_QMimeData, -1, 11},
{sipName_QObjectCleanupHandler, &sipType_QObjectCleanupHandler, -1, 12},
{sipName_QPluginLoader, &sipType_QPluginLoader, -1, 13},
{sipName_QSettings, &sipType_QSettings, -1, 14},
{sipName_QSharedMemory, &sipType_QSharedMemory, -1, 15},
{sipName_QSignalMapper, &sipType_QSignalMapper, -1, 16},
{sipName_QSocketNotifier, &sipType_QSocketNotifier, -1, 17},
{sipName_QThread, &sipType_QThread, -1, 18},
{sipName_QThreadPool, &sipType_QThreadPool, -1, 19},
{sipName_QTimeLine, &sipType_QTimeLine, -1, 20},
{sipName_QTimer, &sipType_QTimer, -1, 21},
{sipName_QTranslator, &sipType_QTranslator, -1, 22},
#if defined(Q_OS_WIN)
{sipName_QWinEventNotifier, &sipType_QWinEventNotifier, -1, -1},
#else
{0, 0, -1, -1},
#endif
{sipName_QAnimationGroup, &sipType_QAnimationGroup, 26, 24},
{sipName_QPauseAnimation, &sipType_QPauseAnimation, -1, 25},
{sipName_QVariantAnimation, &sipType_QVariantAnimation, 28, -1},
{sipName_QParallelAnimationGroup, &sipType_QParallelAnimationGroup, -1, 27},
{sipName_QSequentialAnimationGroup, &sipType_QSequentialAnimationGroup, -1, -1},
{sipName_QPropertyAnimation, &sipType_QPropertyAnimation, -1, -1},
{sipName_QAbstractListModel, &sipType_QAbstractListModel, 33, 30},
{sipName_QAbstractProxyModel, &sipType_QAbstractProxyModel, 34, 31},
{sipName_QAbstractTableModel, &sipType_QAbstractTableModel, -1, 32},
{sipName_QConcatenateTablesProxyModel, &sipType_QConcatenateTablesProxyModel, -1, -1},
{sipName_QStringListModel, &sipType_QStringListModel, -1, -1},
{sipName_QIdentityProxyModel, &sipType_QIdentityProxyModel, -1, 35},
{sipName_QSortFilterProxyModel, &sipType_QSortFilterProxyModel, -1, 36},
{sipName_QTransposeProxyModel, &sipType_QTransposeProxyModel, -1, -1},
{sipName_QBuffer, &sipType_QBuffer, -1, 38},
{sipName_QFileDevice, &sipType_QFileDevice, 40, 39},
#if !defined(QT_NO_PROCESS)
{sipName_QProcess, &sipType_QProcess, -1, -1},
#else
{0, 0, -1, -1},
#endif
{sipName_QFile, &sipType_QFile, 42, 41},
{sipName_QSaveFile, &sipType_QSaveFile, -1, -1},
{sipName_QTemporaryFile, &sipType_QTemporaryFile, -1, -1},
};
int i = 0;
sipType = NULL;
do
{
struct class_graph *cg = &graph[i];
if (cg->name != NULL && sipCpp->inherits(cg->name))
{
sipType = *cg->type;
i = cg->yes;
}
else
i = cg->no;
}
while (i >= 0);
%End
%GCTraverseCode
// Traverse any saved slots we might be connected to.
sipRes = qpycore_visitSlotProxies(sipCpp, sipVisit, sipArg);
%End
%GCClearCode
// Clear any saved slots we might be connected to.
sipRes = qpycore_clearSlotProxies(sipCpp);
%End
public:
static const QMetaObject staticMetaObject {
%GetCode
sipPy = qpycore_qobject_staticmetaobject(sipPyType);
%End
};
const QMetaObject *metaObject() const;
explicit QObject(QObject *parent /TransferThis/ = 0);
virtual ~QObject();
void pyqtConfigure(SIP_PYOBJECT) /NoArgParser/;
%Docstring
QObject.pyqtConfigure(...)
Each keyword argument is either the name of a Qt property or a Qt signal.
For properties the property is set to the given value which should be of an
appropriate type.
For signals the signal is connected to the given value which should be a
callable.
%End
%MethodCode
return qpycore_pyqtconfigure(sipSelf, sipArgs, sipKwds);
%End
SIP_PYOBJECT __getattr__(const char *name /Encoding="UTF-8"/) const /NoTypeHint/;
%MethodCode
sipRes = qpycore_qobject_getattr(sipCpp, sipSelf, a0);
%End
virtual bool event(QEvent *);
virtual bool eventFilter(QObject *, QEvent *);
static QString tr(const char *sourceText /Encoding="UTF-8"/, const char *disambiguation = 0, int n = -1);
%MethodCode
sipRes = new QString(QCoreApplication::translate(sipPyTypeName((PyTypeObject *)sipSelf), a0, a1, a2));
%End
SIP_PYOBJECT findChild(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/;
%MethodCode
sipRes = qtcore_FindChild(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYOBJECT findChild(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/;
%MethodCode
sipRes = qtcore_FindChild(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
%MethodCode
sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
%MethodCode
sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
%MethodCode
sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
%MethodCode
sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
if (!sipRes)
sipIsErr = 1;
%End
QString objectName() const;
%If (Qt_6_4_0 -)
void setObjectName(QAnyStringView name);
%End
%If (- Qt_6_4_0)
void setObjectName(const QString &name);
%End
bool isWidgetType() const;
bool isWindowType() const;
bool signalsBlocked() const;
bool blockSignals(bool b);
QThread *thread() const;
void moveToThread(QThread *thread);
int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
void killTimer(int id);
const QObjectList &children() const;
void setParent(QObject * /TransferThis/);
void installEventFilter(QObject *);
void removeEventFilter(QObject *);
void dumpObjectInfo() const;
void dumpObjectTree() const;
QList<QByteArray> dynamicPropertyNames() const;
bool setProperty(const char *name, const QVariant &value);
QVariant property(const char *name) const;
signals:
void destroyed(QObject *object = 0);
void objectNameChanged(const QString &objectName);
public:
QObject *parent() const;
bool inherits(const char *classname) const;
public slots:
void deleteLater() /TransferThis/;
protected:
QObject *sender() const /ReleaseGIL/;
%MethodCode
// sender() must be called without the GIL to avoid possible deadlocks between
// the GIL and Qt's internal thread data mutex.
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipCpp->sender();
#else
sipRes = sipCpp->sipProtect_sender();
#endif
Py_END_ALLOW_THREADS
if (!sipRes)
{
typedef QObject *(*qtcore_qobject_sender_t)();
static qtcore_qobject_sender_t qtcore_qobject_sender = 0;
if (!qtcore_qobject_sender)
{
qtcore_qobject_sender = (qtcore_qobject_sender_t)sipImportSymbol("qtcore_qobject_sender");
Q_ASSERT(qtcore_qobject_sender);
}
sipRes = qtcore_qobject_sender();
}
%End
int receivers(SIP_PYOBJECT signal /TypeHint="PYQT_SIGNAL"/) const [int (const char *signal)];
%MethodCode
// We need to handle the signal object. Import the helper if it hasn't already
// been done.
typedef sipErrorState (*pyqt6_get_signal_signature_t)(PyObject *, const QObject *, const QByteArray &);
static pyqt6_get_signal_signature_t pyqt6_get_signal_signature = 0;
if (!pyqt6_get_signal_signature)
{
pyqt6_get_signal_signature = (pyqt6_get_signal_signature_t)sipImportSymbol("pyqt6_get_signal_signature");
Q_ASSERT(pyqt6_get_signal_signature);
}
QByteArray signal_signature;
#if defined(SIP_PROTECTED_IS_PUBLIC)
if ((sipError = pyqt6_get_signal_signature(a0, sipCpp, signal_signature)) == sipErrorNone)
{
sipRes = sipCpp->receivers(signal_signature.constData());
}
#else
if ((sipError = pyqt6_get_signal_signature(a0, static_cast<const QObject *>(sipCpp), signal_signature)) == sipErrorNone)
{
sipRes = sipCpp->sipProtect_receivers(signal_signature.constData());
}
#endif
else if (sipError == sipErrorContinue)
{
sipError = sipBadCallableArg(0, a0);
}
%End
virtual void timerEvent(QTimerEvent *);
virtual void childEvent(QChildEvent *);
virtual void customEvent(QEvent *);
virtual void connectNotify(const QMetaMethod &signal);
virtual void disconnectNotify(const QMetaMethod &signal);
int senderSignalIndex() const;
bool isSignalConnected(const QMetaMethod &signal) const;
public:
static bool disconnect(const QMetaObject::Connection &);
SIP_PYOBJECT disconnect() const /TypeHint=""/;
%MethodCode
sipRes = qpycore_qobject_disconnect(sipCpp);
%End
%If (Qt_6_4_0 -)
bool isQuickItemType() const;
%End
private:
QObject(const QObject &);
};
SIP_PYOBJECT pyqtClassInfo(const char *, const char *) /NoArgParser, TypeHint=""/;
%MethodCode
return qpycore_pyqtClassInfo(sipArgs, sipKwds);
%End
SIP_PYOBJECT pyqtEnum(SIP_PYENUM = 0) /TypeHint=""/;
%MethodCode
sipRes = qpycore_pyqtEnum(a0);
%End
SIP_PYOBJECT pyqtSlot(... types, const char *name = 0, const char *result = 0) /NoArgParser, NoTypeHint/;
%Docstring
@pyqtSlot(*types, name: typing.Optional[str], result: typing.Optional[str])
This is a decorator applied to Python methods of a QObject that marks them
as Qt slots.
The non-keyword arguments are the types of the slot arguments and each may
be a Python type object or a string specifying a C++ type.
name is the name of the slot and defaults to the name of the method.
result is type of the value returned by the slot.
%End
%MethodCode
return qpycore_pyqtslot(sipArgs, sipKwds);
%End
SIP_PYOBJECT QT_TR_NOOP(SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/;
%MethodCode
Py_INCREF(a0);
sipRes = a0;
%End
SIP_PYOBJECT QT_TRANSLATE_NOOP(SIP_PYOBJECT /TypeHint="str"/, SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/;
%MethodCode
Py_INCREF(a1);
sipRes = a1;
%End
class QSignalBlocker
{
%TypeHeaderCode
#include <qobject.h>
%End
public:
explicit QSignalBlocker(QObject *o);
~QSignalBlocker();
%If (Qt_6_7_0 -)
void dismiss();
%End
void reblock();
void unblock();
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
sipCpp->unblock();
%End
private:
QSignalBlocker(const QSignalBlocker &);
};
%ModuleHeaderCode
#include "qpycore_api.h"
%End
%InitialisationCode
qpycore_init();
%End
%PostInitialisationCode
qpycore_post_init(sipModuleDict);
%End
@@ -0,0 +1,36 @@
// qobjectcleanuphandler.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QObjectCleanupHandler : public QObject
{
%TypeHeaderCode
#include <qobjectcleanuphandler.h>
%End
public:
QObjectCleanupHandler();
virtual ~QObjectCleanupHandler();
QObject *add(QObject *object);
void remove(QObject *object);
bool isEmpty() const;
void clear();
};
@@ -0,0 +1,197 @@
// qobjectdefs.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
struct QMetaObject
{
%TypeHeaderCode
#include <qobjectdefs.h>
%End
%TypeCode
// Raise an exception when QMetaObject::invokeMethod() returns false.
static void qtcore_invokeMethod_exception()
{
PyErr_SetString(PyExc_RuntimeError, "QMetaObject.invokeMethod() call failed");
}
%End
%If (Qt_6_2_0 -)
QMetaType metaType() const;
%End
const char *className() const;
const QMetaObject *superClass() const;
QMetaProperty userProperty() const;
int methodOffset() const;
int enumeratorOffset() const;
int propertyOffset() const;
int classInfoOffset() const;
int methodCount() const;
int enumeratorCount() const;
int propertyCount() const;
int classInfoCount() const;
int indexOfMethod(const char *method) const;
int indexOfSignal(const char *signal) const;
int indexOfSlot(const char *slot) const;
int indexOfEnumerator(const char *name) const;
int indexOfProperty(const char *name) const;
int indexOfClassInfo(const char *name) const;
QMetaMethod method(int index) const;
QMetaEnum enumerator(int index) const;
QMetaProperty property(int index) const;
QMetaClassInfo classInfo(int index) const;
static bool checkConnectArgs(const char *signal, const char *method);
static void connectSlotsByName(QObject *o /GetWrapper/);
%MethodCode
qpycore_qmetaobject_connectslotsbyname(a0, a0Wrapper);
// Make sure there is no (benign) Python exception.
PyErr_Clear();
%End
static QByteArray normalizedSignature(const char *method);
static QByteArray normalizedType(const char *type);
static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument());
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = QMetaObject::invokeMethod(a0,a1,a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12,*a13);
Py_END_ALLOW_THREADS
if (ok)
sipRes = qpycore_ReturnValue(a3Wrapper);
else
qtcore_invokeMethod_exception();
%End
static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, QGenericReturnArgument ret /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument());
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = QMetaObject::invokeMethod(a0,a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12);
Py_END_ALLOW_THREADS
if (ok)
sipRes = qpycore_ReturnValue(a2Wrapper);
else
qtcore_invokeMethod_exception();
%End
static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument());
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = QMetaObject::invokeMethod(a0,a1,a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12);
Py_END_ALLOW_THREADS
if (ok)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
qtcore_invokeMethod_exception();
}
%End
static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument());
%MethodCode
// Raise an exception if the call failed.
bool ok;
Py_BEGIN_ALLOW_THREADS
ok = QMetaObject::invokeMethod(a0,a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11);
Py_END_ALLOW_THREADS
if (ok)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
qtcore_invokeMethod_exception();
}
%End
%If (Qt_6_5_0 -)
QObject *newInstance(QGenericArgument value0, QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
%End
int constructorCount() const;
int indexOfConstructor(const char *constructor) const;
QMetaMethod constructor(int index) const;
static bool checkConnectArgs(const QMetaMethod &signal, const QMetaMethod &method);
bool inherits(const QMetaObject *metaObject) const;
class Connection
{
%TypeHeaderCode
#include <qobjectdefs.h>
%End
public:
Connection();
Connection(const QMetaObject::Connection &other);
~Connection();
void swap(QMetaObject::Connection &o /Constrained/);
};
};
// The support for Q_ARG(), Q_RETURN_ARG() and supporting classes.
class QGenericArgument /NoDefaultCtors/
{
%TypeHeaderCode
#include <qobjectdefs.h>
%End
public:
~QGenericArgument();
};
SIP_PYOBJECT Q_ARG(SIP_PYOBJECT type, SIP_PYOBJECT data) /TypeHint="QGenericArgument"/;
%MethodCode
sipRes = qpycore_ArgumentFactory(a0, a1);
%End
class QGenericReturnArgument /NoDefaultCtors/
{
%TypeHeaderCode
#include <qobjectdefs.h>
%End
public:
~QGenericReturnArgument();
};
SIP_PYOBJECT Q_RETURN_ARG(SIP_PYOBJECT type) /TypeHint="QGenericReturnArgument"/;
%MethodCode
sipRes = qpycore_ReturnFactory(a0);
%End
@@ -0,0 +1,228 @@
// qoperatingsystemversion.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_3_0 -)
class QOperatingSystemVersionBase
{
%TypeHeaderCode
#include <qoperatingsystemversion.h>
%End
public:
QVersionNumber version() const;
int majorVersion() const;
int minorVersion() const;
int microVersion() const;
int segmentCount() const;
QString name() const;
protected:
QOperatingSystemVersionBase();
};
%End
%If (Qt_6_3_0 -)
class QOperatingSystemVersion : public QOperatingSystemVersionBase
{
%TypeHeaderCode
#include <qoperatingsystemversion.h>
%End
public:
enum OSType
{
Unknown,
Windows,
MacOS,
IOS,
TvOS,
WatchOS,
Android,
};
static const QOperatingSystemVersion Windows7;
static const QOperatingSystemVersion Windows8;
static const QOperatingSystemVersion Windows8_1;
static const QOperatingSystemVersion Windows10;
static const QOperatingSystemVersion OSXMavericks;
static const QOperatingSystemVersion OSXYosemite;
static const QOperatingSystemVersion OSXElCapitan;
static const QOperatingSystemVersion MacOSSierra;
static const QOperatingSystemVersion MacOSHighSierra;
static const QOperatingSystemVersion MacOSMojave;
static const QOperatingSystemVersion MacOSCatalina;
static const QOperatingSystemVersion MacOSBigSur;
static const QOperatingSystemVersion MacOSMonterey;
%If (Qt_6_5_0 -)
static const QOperatingSystemVersionBase MacOSVentura;
%End
%If (Qt_6_6_0 -)
static const QOperatingSystemVersionBase MacOSSonoma;
%End
static const QOperatingSystemVersion AndroidJellyBean;
static const QOperatingSystemVersion AndroidJellyBean_MR1;
static const QOperatingSystemVersion AndroidJellyBean_MR2;
static const QOperatingSystemVersion AndroidKitKat;
static const QOperatingSystemVersion AndroidLollipop;
static const QOperatingSystemVersion AndroidLollipop_MR1;
static const QOperatingSystemVersion AndroidMarshmallow;
static const QOperatingSystemVersion AndroidNougat;
static const QOperatingSystemVersion AndroidNougat_MR1;
static const QOperatingSystemVersion AndroidOreo;
static const QOperatingSystemVersion AndroidOreo_MR1;
static const QOperatingSystemVersion AndroidPie;
static const QOperatingSystemVersion Android10;
static const QOperatingSystemVersion Android11;
%If (Qt_6_5_0 -)
static const QOperatingSystemVersionBase Android12;
%End
%If (Qt_6_5_0 -)
static const QOperatingSystemVersionBase Android12L;
%End
%If (Qt_6_5_0 -)
static const QOperatingSystemVersionBase Android13;
%End
static const QOperatingSystemVersionBase Windows10_1809;
static const QOperatingSystemVersionBase Windows10_1903;
static const QOperatingSystemVersionBase Windows10_1909;
static const QOperatingSystemVersionBase Windows10_2004;
static const QOperatingSystemVersionBase Windows10_20H2;
static const QOperatingSystemVersionBase Windows10_21H1;
static const QOperatingSystemVersionBase Windows10_21H2;
%If (Qt_6_5_0 -)
static const QOperatingSystemVersionBase Windows10_22H2;
%End
static const QOperatingSystemVersionBase Windows11;
%If (Qt_6_4_0 -)
static const QOperatingSystemVersionBase Windows11_21H2;
%End
%If (Qt_6_4_0 -)
static const QOperatingSystemVersionBase Windows11_22H2;
%End
QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = -1, int vmicro = -1);
static QOperatingSystemVersion current();
static QOperatingSystemVersion::OSType currentType();
QOperatingSystemVersion::OSType type() const;
private:
QOperatingSystemVersion();
};
%End
%If (- Qt_6_3_0)
class QOperatingSystemVersion
{
%TypeHeaderCode
#include <qoperatingsystemversion.h>
%End
public:
enum OSType
{
Unknown,
Windows,
MacOS,
IOS,
TvOS,
WatchOS,
Android,
};
static const QOperatingSystemVersion Windows7;
static const QOperatingSystemVersion Windows8;
static const QOperatingSystemVersion Windows8_1;
static const QOperatingSystemVersion Windows10;
static const QOperatingSystemVersion OSXMavericks;
static const QOperatingSystemVersion OSXYosemite;
static const QOperatingSystemVersion OSXElCapitan;
static const QOperatingSystemVersion MacOSSierra;
static const QOperatingSystemVersion MacOSHighSierra;
static const QOperatingSystemVersion MacOSMojave;
static const QOperatingSystemVersion MacOSCatalina;
static const QOperatingSystemVersion MacOSBigSur;
static const QOperatingSystemVersion AndroidJellyBean;
static const QOperatingSystemVersion AndroidJellyBean_MR1;
static const QOperatingSystemVersion AndroidJellyBean_MR2;
static const QOperatingSystemVersion AndroidKitKat;
static const QOperatingSystemVersion AndroidLollipop;
static const QOperatingSystemVersion AndroidLollipop_MR1;
static const QOperatingSystemVersion AndroidMarshmallow;
static const QOperatingSystemVersion AndroidNougat;
static const QOperatingSystemVersion AndroidNougat_MR1;
static const QOperatingSystemVersion AndroidOreo;
%If (Qt_6_1_0 -)
static const QOperatingSystemVersion AndroidOreo_MR1;
%End
%If (Qt_6_1_0 -)
static const QOperatingSystemVersion AndroidPie;
%End
%If (Qt_6_1_0 -)
static const QOperatingSystemVersion Android11;
%End
%If (Qt_6_1_0 -)
static const QOperatingSystemVersion Android10;
%End
QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = -1, int vmicro = -1);
static QOperatingSystemVersion current();
static QOperatingSystemVersion::OSType currentType();
%If (Qt_6_1_0 -)
QVersionNumber version() const;
%End
int majorVersion() const;
int minorVersion() const;
int microVersion() const;
int segmentCount() const;
QOperatingSystemVersion::OSType type() const;
QString name() const;
private:
QOperatingSystemVersion();
};
%End
%If (Qt_6_3_0 -)
bool operator>(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs);
%End
%If (- Qt_6_3_0)
bool operator>(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs);
%End
%If (Qt_6_3_0 -)
bool operator>=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs);
%End
%If (- Qt_6_3_0)
bool operator>=(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs);
%End
%If (Qt_6_3_0 -)
bool operator<(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs);
%End
%If (- Qt_6_3_0)
bool operator<(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs);
%End
%If (Qt_6_3_0 -)
bool operator<=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs);
%End
%If (- Qt_6_3_0)
bool operator<=(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs);
%End
@@ -0,0 +1,39 @@
// qparallelanimationgroup.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QParallelAnimationGroup : public QAnimationGroup
{
%TypeHeaderCode
#include <qparallelanimationgroup.h>
%End
public:
QParallelAnimationGroup(QObject *parent /TransferThis/ = 0);
virtual ~QParallelAnimationGroup();
virtual int duration() const;
protected:
virtual bool event(QEvent *event);
virtual void updateCurrentTime(int currentTime);
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
virtual void updateDirection(QAbstractAnimation::Direction direction);
};
@@ -0,0 +1,39 @@
// qpauseanimation.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QPauseAnimation : public QAbstractAnimation
{
%TypeHeaderCode
#include <qpauseanimation.h>
%End
public:
QPauseAnimation(QObject *parent /TransferThis/ = 0);
QPauseAnimation(int msecs, QObject *parent /TransferThis/ = 0);
virtual ~QPauseAnimation();
virtual int duration() const;
void setDuration(int msecs);
protected:
virtual bool event(QEvent *e);
virtual void updateCurrentTime(int);
};
@@ -0,0 +1,311 @@
// qpermissions.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QPermission /TypeHintIn="Union[QBluetoothPermission, QCalendarPermission, QCameraPermission, QContactsPermission, QLocationPermission, QMicrophonePermission]"/
{
%TypeHeaderCode
#include <qpermissions.h>
%End
%ConvertToTypeCode
// Note that we don't allow sub-classes of the typed permissions.
const sipTypeDef *td = sipTypeFromPyTypeObject(Py_TYPE(sipPy));
if (!sipIsErr)
return (td == sipType_QBluetoothPermission ||
td == sipType_QCalendarPermission ||
td == sipType_QCameraPermission ||
td == sipType_QContactsPermission ||
td == sipType_QLocationPermission ||
td == sipType_QMicrophonePermission);
void *cpp = sipConvertToType(sipPy, td, sipTransferObj, SIP_NOT_NONE, NULL, sipIsErr);
if (*sipIsErr)
return 0;
if (td == sipType_QBluetoothPermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QBluetoothPermission *>(cpp));
else if (td == sipType_QCalendarPermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QCalendarPermission *>(cpp));
else if (td == sipType_QCameraPermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QCameraPermission *>(cpp));
else if (td == sipType_QContactsPermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QContactsPermission *>(cpp));
else if (td == sipType_QLocationPermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QLocationPermission *>(cpp));
else if (td == sipType_QMicrophonePermission)
*sipCppPtr = new QPermission(*reinterpret_cast<QMicrophonePermission *>(cpp));
return sipGetState(sipTransferObj);
%End
public:
QPermission();
Qt::PermissionStatus status() const;
QMetaType type() const;
SIP_PYOBJECT value() const;
%MethodCode
const sipTypeDef *td = SIP_NULLPTR;
void *perm = SIP_NULLPTR;
QMetaType mt = sipCpp->type();
if (mt == QMetaType::fromType<QBluetoothPermission>())
{
std::optional<QBluetoothPermission> opt_perm = sipCpp->value<QBluetoothPermission>();
if (opt_perm)
{
perm = new QBluetoothPermission(opt_perm.value());
td = sipType_QBluetoothPermission;
}
}
else if (mt == QMetaType::fromType<QCalendarPermission>())
{
std::optional<QCalendarPermission> opt_perm = sipCpp->value<QCalendarPermission>();
if (opt_perm)
{
perm = new QCalendarPermission(opt_perm.value());
td = sipType_QCalendarPermission;
}
}
else if (mt == QMetaType::fromType<QCameraPermission>())
{
std::optional<QCameraPermission> opt_perm = sipCpp->value<QCameraPermission>();
if (opt_perm)
{
perm = new QCameraPermission(opt_perm.value());
td = sipType_QCameraPermission;
}
}
else if (mt == QMetaType::fromType<QContactsPermission>())
{
std::optional<QContactsPermission> opt_perm = sipCpp->value<QContactsPermission>();
if (opt_perm)
{
perm = new QContactsPermission(opt_perm.value());
td = sipType_QContactsPermission;
}
}
else if (mt == QMetaType::fromType<QLocationPermission>())
{
std::optional<QLocationPermission> opt_perm = sipCpp->value<QLocationPermission>();
if (opt_perm)
{
perm = new QLocationPermission(opt_perm.value());
td = sipType_QLocationPermission;
}
}
else if (mt == QMetaType::fromType<QMicrophonePermission>())
{
std::optional<QMicrophonePermission> opt_perm = sipCpp->value<QMicrophonePermission>();
if (opt_perm)
{
perm = new QMicrophonePermission(opt_perm.value());
td = sipType_QMicrophonePermission;
}
}
if (perm)
{
sipRes = sipConvertFromNewType(perm, td, SIP_NULLPTR);
}
else
{
sipRes = Py_None;
Py_INCREF(sipRes);
}
%End
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QLocationPermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QLocationPermission();
QLocationPermission(const QLocationPermission &other);
~QLocationPermission();
enum Accuracy
{
Approximate,
Precise,
};
void setAccuracy(QLocationPermission::Accuracy accuracy);
QLocationPermission::Accuracy accuracy() const;
enum Availability
{
WhenInUse,
Always,
};
void setAvailability(QLocationPermission::Availability availability);
QLocationPermission::Availability availability() const;
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QCalendarPermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QCalendarPermission();
QCalendarPermission(const QCalendarPermission &other);
~QCalendarPermission();
enum AccessMode
{
ReadOnly,
ReadWrite,
};
void setAccessMode(QCalendarPermission::AccessMode mode);
QCalendarPermission::AccessMode accessMode() const;
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QContactsPermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QContactsPermission();
QContactsPermission(const QContactsPermission &other);
~QContactsPermission();
enum AccessMode
{
ReadOnly,
ReadWrite,
};
void setAccessMode(QContactsPermission::AccessMode mode);
QContactsPermission::AccessMode accessMode() const;
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QCameraPermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QCameraPermission();
QCameraPermission(const QCameraPermission &other);
~QCameraPermission();
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QMicrophonePermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QMicrophonePermission();
QMicrophonePermission(const QMicrophonePermission &other);
~QMicrophonePermission();
};
%End
%End
%If (Qt_6_5_0 -)
%If (PyQt_Permissions)
class QBluetoothPermission
{
%TypeHeaderCode
#include <qpermissions.h>
%End
public:
QBluetoothPermission();
QBluetoothPermission(const QBluetoothPermission &other);
~QBluetoothPermission();
%If (Qt_6_6_0 -)
enum CommunicationMode
{
Access,
Advertise,
Default,
};
%End
%If (Qt_6_6_0 -)
typedef QFlags<QBluetoothPermission::CommunicationMode> CommunicationModes;
%End
%If (Qt_6_6_0 -)
void setCommunicationModes(QBluetoothPermission::CommunicationModes modes);
%End
%If (Qt_6_6_0 -)
QBluetoothPermission::CommunicationModes communicationModes() const;
%End
};
%End
%End
@@ -0,0 +1,43 @@
// qpluginloader.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QPluginLoader : public QObject
{
%TypeHeaderCode
#include <qpluginloader.h>
%End
public:
explicit QPluginLoader(QObject *parent /TransferThis/ = 0);
QPluginLoader(const QString &fileName, QObject *parent /TransferThis/ = 0);
virtual ~QPluginLoader();
QObject *instance();
static QObjectList staticInstances();
bool load();
bool unload();
bool isLoaded() const;
void setFileName(const QString &fileName);
QString fileName() const;
QString errorString() const;
void setLoadHints(QLibrary::LoadHints loadHints);
QLibrary::LoadHints loadHints() const;
};
@@ -0,0 +1,176 @@
// qpoint.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qpoint.h>
%End
class QPoint
{
%TypeHeaderCode
#include <qpoint.h>
%End
%PickleCode
sipRes = Py_BuildValue("ii", sipCpp->x(), sipCpp->y());
%End
public:
int manhattanLength() const;
QPoint();
QPoint(int xpos, int ypos);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QPoint()");
}
else
{
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QPoint(%i, %i)", sipCpp->x(), sipCpp->y());
}
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
int x() const;
int y() const;
void setX(int xpos);
void setY(int ypos);
QPoint &operator+=(const QPoint &p);
QPoint &operator-=(const QPoint &p);
QPoint &operator*=(int c /Constrained/);
QPoint &operator*=(double c);
QPoint &operator/=(qreal c);
static int dotProduct(const QPoint &p1, const QPoint &p2);
QPoint transposed() const;
%If (Qt_6_4_0 -)
QPointF toPointF() const;
%End
};
QDataStream &operator<<(QDataStream &, const QPoint &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QPoint & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator==(const QPointF &lhs, const QPoint &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QPoint &lhs, const QPointF &rhs);
%End
bool operator==(const QPoint &p1, const QPoint &p2);
%If (Qt_6_8_0 -)
bool operator!=(const QPointF &lhs, const QPoint &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QPoint &lhs, const QPointF &rhs);
%End
bool operator!=(const QPoint &p1, const QPoint &p2);
QPoint operator+(const QPoint &p);
QPoint operator+(const QPoint &p1, const QPoint &p2);
QPoint operator-(const QPoint &p);
QPoint operator-(const QPoint &p1, const QPoint &p2);
QPoint operator*(const QPoint &p, int factor /Constrained/);
QPoint operator*(int factor /Constrained/, const QPoint &p);
QPoint operator*(const QPoint &p, double factor);
QPoint operator*(double factor, const QPoint &p);
QPoint operator/(const QPoint &p, qreal c);
class QPointF
{
%TypeHeaderCode
#include <qpoint.h>
%End
%PickleCode
sipRes = Py_BuildValue("dd", sipCpp->x(), sipCpp->y());
%End
public:
QPointF();
QPointF(qreal xpos, qreal ypos);
QPointF(const QPoint &p);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QPointF()");
}
else
{
PyObject *x = PyFloat_FromDouble(sipCpp->x());
PyObject *y = PyFloat_FromDouble(sipCpp->y());
if (x && y)
sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QPointF(%R, %R)", x, y);
Py_XDECREF(x);
Py_XDECREF(y);
}
%End
bool isNull() const;
int __bool__() const;
%MethodCode
sipRes = !sipCpp->isNull();
%End
qreal x() const;
qreal y() const;
void setX(qreal xpos);
void setY(qreal ypos);
QPointF &operator+=(const QPointF &p);
QPointF &operator-=(const QPointF &p);
QPointF &operator*=(qreal c);
QPointF &operator/=(qreal c);
QPoint toPoint() const;
qreal manhattanLength() const;
static qreal dotProduct(const QPointF &p1, const QPointF &p2);
QPointF transposed() const;
};
QDataStream &operator<<(QDataStream &, const QPointF &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QPointF & /Constrained/) /ReleaseGIL/;
bool operator==(const QPointF &p1, const QPointF &p2);
bool operator!=(const QPointF &p1, const QPointF &p2);
QPointF operator+(const QPointF &p);
QPointF operator+(const QPointF &p1, const QPointF &p2);
QPointF operator-(const QPointF &p);
QPointF operator-(const QPointF &p1, const QPointF &p2);
QPointF operator*(const QPointF &p, qreal c);
QPointF operator*(qreal c, const QPointF &p);
QPointF operator/(const QPointF &p, qreal divisor);
%If (Qt_6_8_0 -)
bool qFuzzyCompare(const QPointF &p1, const QPointF &p2);
%End
%If (Qt_6_8_0 -)
bool qFuzzyIsNull(const QPointF &point);
%End
@@ -0,0 +1,312 @@
// qprocess.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (PyQt_Process)
class QProcess : public QIODevice
{
%TypeHeaderCode
#include <qprocess.h>
%End
public:
enum ExitStatus
{
NormalExit,
CrashExit,
};
enum ProcessError
{
FailedToStart,
Crashed,
Timedout,
ReadError,
WriteError,
UnknownError,
};
enum ProcessState
{
NotRunning,
Starting,
Running,
};
enum ProcessChannel
{
StandardOutput,
StandardError,
};
enum ProcessChannelMode
{
SeparateChannels,
MergedChannels,
ForwardedChannels,
ForwardedOutputChannel,
ForwardedErrorChannel,
};
explicit QProcess(QObject *parent /TransferThis/ = 0);
virtual ~QProcess();
void start(const QString &program, const QStringList &arguments = {}, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/;
void start(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/;
void startCommand(const QString &command, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/;
QProcess::ProcessChannel readChannel() const;
void setReadChannel(QProcess::ProcessChannel channel);
void closeReadChannel(QProcess::ProcessChannel channel);
void closeWriteChannel();
QString workingDirectory() const;
void setWorkingDirectory(const QString &dir);
QProcess::ProcessError error() const;
QProcess::ProcessState state() const;
bool waitForStarted(int msecs = 30000) /ReleaseGIL/;
virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/;
virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/;
bool waitForFinished(int msecs = 30000) /ReleaseGIL/;
QByteArray readAllStandardOutput() /ReleaseGIL/;
QByteArray readAllStandardError() /ReleaseGIL/;
int exitCode() const;
QProcess::ExitStatus exitStatus() const;
virtual qint64 bytesToWrite() const;
virtual bool isSequential() const;
virtual void close();
static int execute(const QString &program, const QStringList &arguments = {}) /ReleaseGIL/;
static bool startDetached(const QString &program, const QStringList &arguments = {}, const QString &workingDirectory = QString(), qint64 *pid = 0);
bool startDetached(qint64 *pid = 0);
static QStringList systemEnvironment();
QProcess::ProcessChannelMode processChannelMode() const;
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
void setStandardInputFile(const QString &fileName);
void setStandardOutputFile(const QString &fileName, QIODeviceBase::OpenMode mode = QIODeviceBase::Truncate);
void setStandardErrorFile(const QString &fileName, QIODeviceBase::OpenMode mode = QIODeviceBase::Truncate);
void setStandardOutputProcess(QProcess *destination);
public slots:
void terminate();
void kill();
signals:
void started();
void finished(int exitCode, QProcess::ExitStatus exitStatus = QProcess::NormalExit);
void stateChanged(QProcess::ProcessState state);
void readyReadStandardOutput();
void readyReadStandardError();
void errorOccurred(QProcess::ProcessError error);
protected:
void setProcessState(QProcess::ProcessState state);
virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)];
%MethodCode
// Return the data read or None if there was an error.
if (a0 < 0)
{
PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative");
sipIsErr = 1;
}
else
{
char *s = new char[a0];
qint64 len;
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
len = sipSelfWasArg ? sipCpp->QProcess::readData(s, a0) : sipCpp->readData(s, a0);
#else
len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0);
#endif
Py_END_ALLOW_THREADS
if (len < 0)
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
else
{
sipRes = PyBytes_FromStringAndSize(s, len);
if (!sipRes)
sipIsErr = 1;
}
delete[] s;
}
%End
virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipSelfWasArg ?
sipCpp->QProcess::writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len) :
sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
#else
sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
#endif
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
public:
void setProcessEnvironment(const QProcessEnvironment &environment);
QProcessEnvironment processEnvironment() const;
QString program() const;
void setProgram(const QString &program);
QStringList arguments() const;
void setArguments(const QStringList &arguments);
virtual bool open(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/;
enum InputChannelMode
{
ManagedInputChannel,
ForwardedInputChannel,
};
QProcess::InputChannelMode inputChannelMode() const;
void setInputChannelMode(QProcess::InputChannelMode mode);
static QString nullDevice();
qint64 processId() const;
%If (Qt_6_6_0 -)
%If (Linux || macOS)
enum class UnixProcessFlag
{
ResetSignalHandlers,
IgnoreSigPipe,
CloseFileDescriptors,
UseVFork,
%If (Qt_6_7_0 -)
CreateNewSession,
%End
%If (Qt_6_7_0 -)
DisconnectControllingTerminal,
%End
%If (Qt_6_7_0 -)
ResetIds,
%End
};
%End
%End
%If (Qt_6_6_0 -)
%If (Linux || macOS)
typedef QFlags<QProcess::UnixProcessFlag> UnixProcessFlags;
%End
%End
%If (Qt_6_6_0 -)
%If (Linux || macOS)
struct UnixProcessParameters
{
%TypeHeaderCode
#include <qprocess.h>
%End
QProcess::UnixProcessFlags flags;
int lowestFileDescriptorToClose;
};
%End
%End
%If (Qt_6_6_0 -)
%If (Linux || macOS)
QProcess::UnixProcessParameters unixProcessParameters() const;
%End
%End
%If (Qt_6_6_0 -)
%If (Linux || macOS)
void setUnixProcessParameters(QProcess::UnixProcessFlags flagsOnly);
%End
%End
%If (Qt_6_6_0 -)
%If (Linux || macOS)
void setUnixProcessParameters(const QProcess::UnixProcessParameters &params);
%End
%End
};
%End
%If (PyQt_Process)
class QProcessEnvironment
{
%TypeHeaderCode
#include <qprocess.h>
%End
public:
%If (Qt_6_3_0 -)
enum Initialization
{
InheritFromParent,
};
%End
%If (Qt_6_3_0 -)
QProcessEnvironment(QProcessEnvironment::Initialization);
%End
QProcessEnvironment();
QProcessEnvironment(const QProcessEnvironment &other);
~QProcessEnvironment();
%If (- Qt_6_8_0)
bool operator==(const QProcessEnvironment &other) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QProcessEnvironment &other) const;
%End
bool isEmpty() const;
void clear();
bool contains(const QString &name) const;
void insert(const QString &name, const QString &value);
void insert(const QProcessEnvironment &e);
void remove(const QString &name);
QString value(const QString &name, const QString &defaultValue = QString()) const;
QStringList toStringList() const;
static QProcessEnvironment systemEnvironment();
QStringList keys() const;
void swap(QProcessEnvironment &other /Constrained/);
%If (Qt_6_3_0 -)
bool inheritsFromParent() const;
%End
};
%End
%If (Qt_6_8_0 -)
bool operator!=(const QProcessEnvironment &lhs, const QProcessEnvironment &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QProcessEnvironment &lhs, const QProcessEnvironment &rhs);
%End
@@ -0,0 +1,42 @@
// qpropertyanimation.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QPropertyAnimation : public QVariantAnimation
{
%TypeHeaderCode
#include <qpropertyanimation.h>
%End
public:
QPropertyAnimation(QObject *parent /TransferThis/ = 0);
QPropertyAnimation(QObject *target /KeepReference=0/, const QByteArray &propertyName, QObject *parent /TransferThis/ = 0);
virtual ~QPropertyAnimation();
QObject *targetObject() const;
void setTargetObject(QObject *target /KeepReference=0/);
QByteArray propertyName() const;
void setPropertyName(const QByteArray &propertyName);
protected:
virtual bool event(QEvent *event);
virtual void updateCurrentValue(const QVariant &value);
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
};
@@ -0,0 +1,489 @@
// This is the SIP interface definition for the majority of the QHash based
// mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
template<_TYPE1_, _TYPE2_>
%MappedType QHash<_TYPE1_, _TYPE2_>
/TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qhash.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QHash<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin();
QHash<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
_TYPE1_ *k = new _TYPE1_(it.key());
PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
return 0;
}
_TYPE2_ *v = new _TYPE2_(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QHash<_TYPE1_, _TYPE2_> *qh = new QHash<_TYPE1_, _TYPE2_>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int kstate;
_TYPE1_ *k = reinterpret_cast<_TYPE1_ *>(
sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj,
SIP_NOT_NONE, &kstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but '_TYPE1_' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qh;
return 0;
}
int vstate;
_TYPE2_ *v = reinterpret_cast<_TYPE2_ *>(
sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE2_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qh;
return 0;
}
qh->insert(*k, *v);
sipReleaseType(v, sipType__TYPE2_, vstate);
sipReleaseType(k, sipType__TYPE1_, kstate);
}
*sipCppPtr = qh;
return sipGetState(sipTransferObj);
%End
};
// This is only needed for QtWebChannel but is sufficiently generic that we
// include it here.
template<_TYPE1_, _TYPE2_ *>
%MappedType QHash<_TYPE1_, _TYPE2_ *>
/TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qhash.h>
%End
%ConvertFromTypeCode
int gc_enabled = sipEnableGC(0);
PyObject *d = PyDict_New();
if (d)
{
QHash<_TYPE1_, _TYPE2_ *>::const_iterator it = sipCpp->constBegin();
QHash<_TYPE1_, _TYPE2_ *>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
_TYPE1_ *k = new _TYPE1_(it.key());
PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
d = 0;
break;
}
_TYPE2_ *v = it.value();
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_,
sipTransferObj);
if (!vobj)
{
Py_DECREF(kobj);
Py_DECREF(d);
d = 0;
break;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
d = 0;
break;
}
++it;
}
}
sipEnableGC(gc_enabled);
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QHash<_TYPE1_, _TYPE2_ *> *qh = new QHash<_TYPE1_, _TYPE2_ *>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int kstate;
_TYPE1_ *k = reinterpret_cast<_TYPE1_ *>(
sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj,
SIP_NOT_NONE, &kstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but '_TYPE1_' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qh;
return 0;
}
_TYPE2_ *v = reinterpret_cast<_TYPE2_ *>(
sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj, 0,
0, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE2_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qh;
return 0;
}
qh->insert(*k, v);
sipReleaseType(k, sipType__TYPE1_, kstate);
}
*sipCppPtr = qh;
return sipGetState(sipTransferObj);
%End
};
template<int, _TYPE_>
%MappedType QHash<int, _TYPE_>
/TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qhash.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QHash<int, _TYPE_>::const_iterator it = sipCpp->constBegin();
QHash<int, _TYPE_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
PyObject *kobj = PyLong_FromLong(it.key());
if (!kobj)
{
Py_DECREF(d);
return 0;
}
_TYPE_ *v = new _TYPE_(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QHash<int, _TYPE_> *qh = new QHash<int, _TYPE_>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int k = sipLong_AsInt(kobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qh;
*sipIsErr = 1;
return 0;
}
int vstate;
_TYPE_ *v = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
delete qh;
return 0;
}
qh->insert(k, *v);
sipReleaseType(v, sipType__TYPE_, vstate);
}
*sipCppPtr = qh;
return sipGetState(sipTransferObj);
%End
};
template<quint16, _TYPE_>
%MappedType QHash<quint16, _TYPE_>
/TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qhash.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QHash<quint16, _TYPE_>::const_iterator it = sipCpp->constBegin();
QHash<quint16, _TYPE_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
PyObject *kobj = PyLong_FromLong(it.key());
if (!kobj)
{
Py_DECREF(d);
return 0;
}
_TYPE_ *v = new _TYPE_(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QHash<quint16, _TYPE_> *qh = new QHash<quint16, _TYPE_>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
quint16 k = sipLong_AsUnsignedShort(kobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qh;
*sipIsErr = 1;
return 0;
}
int vstate;
_TYPE_ *v = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
delete qh;
return 0;
}
qh->insert(k, *v);
sipReleaseType(v, sipType__TYPE_, vstate);
}
*sipCppPtr = qh;
return sipGetState(sipTransferObj);
%End
};
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,425 @@
// This is the SIP interface definition for the majority of the QMap and
// QMultiMap based mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
template<_TYPE1_, _TYPE2_>
%MappedType QMap<_TYPE1_, _TYPE2_>
/TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qmap.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QMap<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin();
QMap<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
_TYPE1_ *k = new _TYPE1_(it.key());
PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
return 0;
}
_TYPE2_ *v = new _TYPE2_(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QMap<_TYPE1_, _TYPE2_> *qm = new QMap<_TYPE1_, _TYPE2_>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int kstate;
_TYPE1_ *k = reinterpret_cast<_TYPE1_ *>(
sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj,
SIP_NOT_NONE, &kstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but '_TYPE1_' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qm;
return 0;
}
int vstate;
_TYPE2_ *v = reinterpret_cast<_TYPE2_ *>(
sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE2_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qm;
return 0;
}
qm->insert(*k, *v);
sipReleaseType(v, sipType__TYPE2_, vstate);
sipReleaseType(k, sipType__TYPE1_, kstate);
}
*sipCppPtr = qm;
return sipGetState(sipTransferObj);
%End
};
template<int, _TYPE_>
%MappedType QMap<int, _TYPE_>
/TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qmap.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QMap<int, _TYPE_>::const_iterator it = sipCpp->constBegin();
QMap<int, _TYPE_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
PyObject *kobj = PyLong_FromLong(it.key());
if (!kobj)
{
Py_DECREF(d);
return 0;
}
_TYPE_ *v = new _TYPE_(it.value());
PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_,
sipTransferObj);
if (!vobj)
{
delete v;
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++it;
}
return d;
%End
%ConvertToTypeCode
if (!sipIsErr)
return PyDict_Check(sipPy);
QMap<int, _TYPE_> *qm = new QMap<int, _TYPE_>;
Py_ssize_t pos = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &pos, &kobj, &vobj))
{
int k = sipLong_AsInt(kobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qm;
*sipIsErr = 1;
return 0;
}
int vstate;
_TYPE_ *v = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj,
SIP_NOT_NONE, &vstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but '_TYPE_' is expected",
sipPyTypeName(Py_TYPE(vobj)));
delete qm;
return 0;
}
qm->insert(k, *v);
sipReleaseType(v, sipType__TYPE_, vstate);
}
*sipCppPtr = qm;
return sipGetState(sipTransferObj);
%End
};
template<_TYPE1_, _TYPE2_>
%MappedType QMultiMap<_TYPE1_, _TYPE2_>
/TypeHintIn="Dict[_TYPE1_, Sequence[_TYPE2_]]", TypeHintOut="Dict[_TYPE1_, List[_TYPE2_]]", TypeHintValue="{}"/
{
%TypeHeaderCode
#include <qmap.h>
%End
%ConvertFromTypeCode
PyObject *d = PyDict_New();
if (!d)
return 0;
QList<_TYPE1_> keys = sipCpp->keys();
QList<_TYPE1_>::const_iterator kit = keys.constBegin();
QList<_TYPE1_>::const_iterator kit_end = keys.constEnd();
while (kit != kit_end)
{
_TYPE1_ *k = new _TYPE1_(*kit);
PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_,
sipTransferObj);
if (!kobj)
{
delete k;
Py_DECREF(d);
return 0;
}
// Create a Python list as the dictionary value.
QList<_TYPE2_> values = sipCpp->values(*kit);
PyObject *vobj = PyList_New(values.count());
if (!vobj)
{
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
QList<_TYPE2_>::const_iterator vit = values.constBegin();
QList<_TYPE2_>::const_iterator vit_end = values.constEnd();
for (int i = 0; vit != vit_end; ++i)
{
_TYPE2_ *sv = new _TYPE2_(*vit);
PyObject *svobj = sipConvertFromNewType(sv, sipType__TYPE2_,
sipTransferObj);
if (!svobj)
{
delete sv;
Py_DECREF(vobj);
Py_DECREF(kobj);
Py_DECREF(d);
return 0;
}
PyList_SetItem(vobj, i, svobj);
++vit;
}
int rc = PyDict_SetItem(d, kobj, vobj);
Py_DECREF(vobj);
Py_DECREF(kobj);
if (rc < 0)
{
Py_DECREF(d);
return 0;
}
++kit;
}
return d;
%End
%ConvertToTypeCode
if (sipIsErr == NULL)
return PyDict_Check(sipPy);
QMultiMap<_TYPE1_, _TYPE2_> *qm = new QMultiMap<_TYPE1_, _TYPE2_>;
Py_ssize_t i = 0;
PyObject *kobj, *vobj;
while (PyDict_Next(sipPy, &i, &kobj, &vobj))
{
int kstate;
_TYPE1_ *k = reinterpret_cast<_TYPE1_ *>(sipConvertToType(kobj, sipType__TYPE1_, sipTransferObj, SIP_NOT_NONE, &kstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a dict key has type '%s' but '_TYPE1_' is expected",
sipPyTypeName(Py_TYPE(kobj)));
delete qm;
return 0;
}
Py_ssize_t vi = PySequence_Size(vobj);
if (vi < 0)
{
PyErr_Format(PyExc_TypeError,
"a dict value has type '%s' but a sequence is expected",
sipPyTypeName(Py_TYPE(vobj)));
*sipIsErr = 1;
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qm;
return 0;
}
// We go through the sequence backwards to maintain the Qt semantics of
// later items appearing first.
while (vi--)
{
PyObject *itm_obj = PySequence_GetItem(vobj, vi);
if (!itm_obj)
{
*sipIsErr = 1;
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qm;
return 0;
}
int itm_state;
_TYPE2_ *itm = reinterpret_cast<_TYPE2_ *>(sipConvertToType(itm_obj, sipType__TYPE2_, sipTransferObj, SIP_NOT_NONE, &itm_state, sipIsErr));
Py_DECREF(itm_obj);
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"a sequence element has type '%s' but '_TYPE2_' is expected",
sipPyTypeName(Py_TYPE(itm_obj)));
sipReleaseType(k, sipType__TYPE1_, kstate);
delete qm;
return 0;
}
qm->insert(*k, *itm);
sipReleaseType(itm, sipType__TYPE2_, itm_state);
}
sipReleaseType(k, sipType__TYPE1_, kstate);
}
*sipCppPtr = qm;
return sipGetState(sipTransferObj);
%End
};
@@ -0,0 +1,244 @@
// This is the SIP interface definition for the majority of the QSet based
// mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
template<_TYPE_>
%MappedType QSet<_TYPE_>
/TypeHintIn="Iterable[_TYPE_]", TypeHintOut="Set[_TYPE_]",
TypeHintValue="set()"/
{
%TypeHeaderCode
#include <qset.h>
%End
%ConvertFromTypeCode
PyObject *s = PySet_New(0);
if (!s)
return 0;
QSet<_TYPE_>::const_iterator it = sipCpp->constBegin();
QSet<_TYPE_>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
_TYPE_ *t = new _TYPE_(*it);
PyObject *tobj = sipConvertFromNewType(t, sipType__TYPE_,
sipTransferObj);
if (!tobj)
{
delete t;
Py_DECREF(s);
return 0;
}
PySet_Add(s, tobj);
++it;
}
return s;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QSet<_TYPE_> *qs = new QSet<_TYPE_>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete qs;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
int state;
_TYPE_ *t = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj,
SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but '_TYPE_' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete qs;
Py_DECREF(iter);
return 0;
}
qs->insert(*t);
sipReleaseType(t, sipType__TYPE_, state);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = qs;
return sipGetState(sipTransferObj);
%End
};
template<_TYPE_>
%MappedType QSet<_TYPE_ *>
/TypeHintIn="Iterable[_TYPE_]", TypeHintOut="Set[_TYPE_]",
TypeHintValue="set()"/
{
%TypeHeaderCode
#include <qset.h>
%End
%ConvertFromTypeCode
int gc_enabled = sipEnableGC(0);
PyObject *s = PySet_New(0);
if (s)
{
QSet<_TYPE_ *>::const_iterator it = sipCpp->constBegin();
QSet<_TYPE_ *>::const_iterator end = sipCpp->constEnd();
while (it != end)
{
// The explicit (void *) cast allows _TYPE_ to be const.
PyObject *tobj = sipConvertFromType((void *)*it, sipType__TYPE_,
sipTransferObj);
if (!tobj)
{
Py_DECREF(s);
s = 0;
break;
}
PySet_Add(s, tobj);
++it;
}
}
sipEnableGC(gc_enabled);
return s;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter(sipPy);
if (!sipIsErr)
{
PyErr_Clear();
Py_XDECREF(iter);
return (iter && !PyUnicode_Check(sipPy));
}
if (!iter)
{
*sipIsErr = 1;
return 0;
}
QSet<_TYPE_ *> *qs = new QSet<_TYPE_ *>;
for (Py_ssize_t i = 0; ; ++i)
{
PyErr_Clear();
PyObject *itm = PyIter_Next(iter);
if (!itm)
{
if (PyErr_Occurred())
{
delete qs;
Py_DECREF(iter);
*sipIsErr = 1;
return 0;
}
break;
}
_TYPE_ *t = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj, 0,
0, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"index %zd has type '%s' but '_TYPE_' is expected", i,
sipPyTypeName(Py_TYPE(itm)));
Py_DECREF(itm);
delete qs;
Py_DECREF(iter);
return 0;
}
qs->insert(t);
Py_DECREF(itm);
}
Py_DECREF(iter);
*sipCppPtr = qs;
return sipGetState(sipTransferObj);
%End
};
@@ -0,0 +1,52 @@
// This is the SIP interface definition for the std::optional mapped type.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%If (Qt_6_7_0 -)
template<_TYPE_>
%MappedType std::optional<_TYPE_> /TypeHint="Optional[_TYPE_]"/
{
%TypeHeaderCode
#include <optional>
%End
%ConvertFromTypeCode
if (!sipCpp->has_value())
{
Py_INCREF(Py_None);
return Py_None;
}
_TYPE_ *t = new _TYPE_(sipCpp->value());
PyObject *tobj = sipConvertFromNewType(t, sipType__TYPE_, sipTransferObj);
if (!tobj)
{
delete t;
return 0;
}
return tobj;
%End
};
%End
@@ -0,0 +1,503 @@
// This is the SIP interface definition for the majority of the std::pair based
// mapped types.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
template<_TYPE1_, _TYPE2_>
%MappedType std::pair<_TYPE1_, _TYPE2_> /TypeHint="Tuple[_TYPE1_, _TYPE2_]"/
{
%TypeHeaderCode
#include <utility>
%End
%ConvertFromTypeCode
_TYPE1_ *first = new _TYPE1_(sipCpp->first);
_TYPE2_ *second = new _TYPE2_(sipCpp->second);
PyObject *t = sipBuildResult(NULL, "(NN)", first, sipType__TYPE1_,
sipTransferObj, second, sipType__TYPE2_, sipTransferObj);
if (!t)
{
delete first;
delete second;
return 0;
}
return t;
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
int firststate;
_TYPE1_ *first = reinterpret_cast<_TYPE1_ *>(
sipForceConvertToType(firstobj, sipType__TYPE1_, sipTransferObj,
SIP_NOT_NONE, &firststate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but '_TYPE1_' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
sipReleaseType(first, sipType__TYPE1_, firststate);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
int secondstate;
_TYPE2_ *second = reinterpret_cast<_TYPE2_ *>(
sipForceConvertToType(secondobj, sipType__TYPE2_, sipTransferObj,
SIP_NOT_NONE, &secondstate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but '_TYPE2_' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
sipReleaseType(first, sipType__TYPE1_, firststate);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<_TYPE1_, _TYPE2_>(*first, *second);
sipReleaseType(second, sipType__TYPE2_, secondstate);
Py_DECREF(secondobj);
sipReleaseType(first, sipType__TYPE1_, firststate);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};
template<_TYPE_>
%MappedType std::pair<_TYPE_, int> /TypeHint="Tuple[_TYPE_, int]"/
{
%TypeHeaderCode
#include <utility>
%End
%ConvertFromTypeCode
_TYPE_ *first = new _TYPE_(sipCpp->first);
PyObject *t = sipBuildResult(NULL, "(Ni)", first, sipType__TYPE_,
sipTransferObj, sipCpp->second);
if (!t)
{
delete first;
return 0;
}
return t;
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
int firststate;
_TYPE_ *first = reinterpret_cast<_TYPE_ *>(
sipForceConvertToType(firstobj, sipType__TYPE_, sipTransferObj,
SIP_NOT_NONE, &firststate, sipIsErr));
if (*sipIsErr)
{
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but '_TYPE_' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
sipReleaseType(first, sipType__TYPE_, firststate);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
int second = sipLong_AsInt(secondobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
sipReleaseType(first, sipType__TYPE_, firststate);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<_TYPE_, int>(*first, second);
Py_DECREF(secondobj);
sipReleaseType(first, sipType__TYPE_, firststate);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};
%MappedType std::pair<int, int> /TypeHint="Tuple[int, int]"/
{
%TypeHeaderCode
#include <utility>
%End
%ConvertFromTypeCode
return Py_BuildValue("(ii)", sipCpp->first, sipCpp->second);
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
int first = sipLong_AsInt(firstobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
*sipIsErr = 1;
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
int second = sipLong_AsInt(secondobj);
if (PyErr_Occurred())
{
if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but 'int' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<int, int>(first, second);
Py_DECREF(secondobj);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};
%MappedType std::pair<float, float> /TypeHint="Tuple[float, float]"/
{
%TypeHeaderCode
#include <utility>
%End
%ConvertFromTypeCode
return Py_BuildValue("(ff)", sipCpp->first, sipCpp->second);
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
PyErr_Clear();
double first = PyFloat_AsDouble(firstobj);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but 'float' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
*sipIsErr = 1;
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
PyErr_Clear();
double second = PyFloat_AsDouble(secondobj);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but 'float' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<float, float>(first, second);;
Py_DECREF(secondobj);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};
%If (Qt_6_2_0 -)
%MappedType std::pair<qreal, qreal> /TypeHint="Tuple[float, float]"/
{
%TypeHeaderCode
#include <utility>
%End
%ConvertFromTypeCode
return Py_BuildValue("(ff)", sipCpp->first, sipCpp->second);
%End
%ConvertToTypeCode
if (!sipIsErr)
return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy));
Py_ssize_t len = PySequence_Size(sipPy);
if (len != 2)
{
// A negative length should only be an internal error so let the
// original exception stand.
if (len >= 0)
PyErr_Format(PyExc_TypeError,
"sequence has %zd elements but 2 elements are expected",
len);
*sipIsErr = 1;
return 0;
}
PyObject *firstobj = PySequence_GetItem(sipPy, 0);
if (!firstobj)
{
*sipIsErr = 1;
return 0;
}
PyErr_Clear();
double first = PyFloat_AsDouble(firstobj);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the first element has type '%s' but 'float' is expected",
sipPyTypeName(Py_TYPE(firstobj)));
*sipIsErr = 1;
return 0;
}
PyObject *secondobj = PySequence_GetItem(sipPy, 1);
if (!secondobj)
{
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
PyErr_Clear();
double second = PyFloat_AsDouble(secondobj);
if (PyErr_Occurred())
{
PyErr_Format(PyExc_TypeError,
"the second element has type '%s' but 'float' is expected",
sipPyTypeName(Py_TYPE(secondobj)));
Py_DECREF(secondobj);
Py_DECREF(firstobj);
*sipIsErr = 1;
return 0;
}
*sipCppPtr = new std::pair<qreal, qreal>(first, second);;
Py_DECREF(secondobj);
Py_DECREF(firstobj);
return sipGetState(sipTransferObj);
%End
};
%End
@@ -0,0 +1,23 @@
// This is the implementation of the PyQt-specific virtual error handler.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%VirtualErrorHandler PyQt6
pyqt6_err_print();
%End
@@ -0,0 +1,53 @@
// qrandom.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QRandomGenerator
{
%TypeHeaderCode
#include <qrandom.h>
%End
public:
QRandomGenerator(quint32 seed = 1);
QRandomGenerator(const QRandomGenerator &other);
%If (Qt_6_8_0 -)
~QRandomGenerator();
%End
quint32 generate();
quint64 generate64();
double generateDouble();
double bounded(double highest /Constrained/);
qint64 bounded(qint64 lowest, qint64 highest);
qint64 bounded(qint64 highest);
typedef quint32 result_type;
QRandomGenerator::result_type operator()();
void seed(quint32 seed = 1);
void discard(unsigned long long z);
static QRandomGenerator::result_type min();
static QRandomGenerator::result_type max();
static QRandomGenerator *system();
static QRandomGenerator *global();
static QRandomGenerator securelySeeded();
};
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2);
bool operator!=(const QRandomGenerator &rng1, const QRandomGenerator &rng2);
@@ -0,0 +1,114 @@
// qreadwritelock.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QReadWriteLock
{
%TypeHeaderCode
#include <qreadwritelock.h>
%End
public:
enum RecursionMode
{
NonRecursive,
Recursive,
};
explicit QReadWriteLock(QReadWriteLock::RecursionMode recursionMode = QReadWriteLock::NonRecursive);
~QReadWriteLock();
void lockForRead() /ReleaseGIL/;
%If (Qt_6_6_0 -)
bool tryLockForRead(QDeadlineTimer timeout = {}) /ReleaseGIL/;
%End
%If (- Qt_6_6_0)
bool tryLockForRead();
%End
bool tryLockForRead(int timeout) /ReleaseGIL/;
void lockForWrite() /ReleaseGIL/;
%If (Qt_6_6_0 -)
bool tryLockForWrite(QDeadlineTimer timeout = {}) /ReleaseGIL/;
%End
%If (- Qt_6_6_0)
bool tryLockForWrite();
%End
bool tryLockForWrite(int timeout) /ReleaseGIL/;
void unlock();
private:
QReadWriteLock(const QReadWriteLock &);
};
class QReadLocker
{
%TypeHeaderCode
#include <qreadwritelock.h>
%End
public:
QReadLocker(QReadWriteLock *areadWriteLock) /ReleaseGIL/;
~QReadLocker();
void unlock();
void relock() /ReleaseGIL/;
QReadWriteLock *readWriteLock() const;
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
sipCpp->unlock();
%End
private:
QReadLocker(const QReadLocker &);
};
class QWriteLocker
{
%TypeHeaderCode
#include <qreadwritelock.h>
%End
public:
QWriteLocker(QReadWriteLock *areadWriteLock) /ReleaseGIL/;
~QWriteLocker();
void unlock();
void relock() /ReleaseGIL/;
QReadWriteLock *readWriteLock() const;
SIP_PYOBJECT __enter__();
%MethodCode
// Just return a reference to self.
sipRes = sipSelf;
Py_INCREF(sipRes);
%End
void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
%MethodCode
sipCpp->unlock();
%End
private:
QWriteLocker(const QWriteLocker &);
};
@@ -0,0 +1,308 @@
// qrect.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
%ModuleCode
#include <qrect.h>
%End
class QRect
{
%TypeHeaderCode
#include <qrect.h>
%End
%PickleCode
sipRes = Py_BuildValue("iiii", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height());
%End
public:
QRect();
QRect normalized() const;
void moveCenter(const QPoint &p);
QRect operator|(const QRect &r) const;
QRect operator&(const QRect &r) const;
bool contains(const QPoint &point, bool proper = false) const;
int __contains__(const QPoint &p) const;
%MethodCode
sipRes = sipCpp->contains(*a0);
%End
bool contains(const QRect &rectangle, bool proper = false) const;
int __contains__(const QRect &r) const;
%MethodCode
sipRes = sipCpp->contains(*a0);
%End
bool intersects(const QRect &r) const;
QRect(int aleft, int atop, int awidth, int aheight);
QRect(const QPoint &atopLeft, const QPoint &abottomRight);
QRect(const QPoint &atopLeft, const QSize &asize);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QRect()");
}
else
{
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QRect(%i, %i, %i, %i)", sipCpp->left(),
sipCpp->top(), sipCpp->width(), sipCpp->height());
}
%End
bool isNull() const;
bool isEmpty() const;
bool isValid() const;
int __bool__() const;
%MethodCode
sipRes = sipCpp->isValid();
%End
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
int left() const;
int top() const;
int right() const;
int bottom() const;
int x() const;
int y() const;
void setLeft(int pos);
void setTop(int pos);
void setRight(int pos);
void setBottom(int pos);
void setTopLeft(const QPoint &p);
void setBottomRight(const QPoint &p);
void setTopRight(const QPoint &p);
void setBottomLeft(const QPoint &p);
void setX(int ax);
void setY(int ay);
QPoint topLeft() const;
QPoint bottomRight() const;
QPoint topRight() const;
QPoint bottomLeft() const;
QPoint center() const;
int width() const;
int height() const;
QSize size() const;
void translate(int dx, int dy);
void translate(const QPoint &p);
QRect translated(int dx, int dy) const;
QRect translated(const QPoint &p) const;
void moveTo(int ax, int ay);
void moveTo(const QPoint &p);
void moveLeft(int pos);
void moveTop(int pos);
void moveRight(int pos);
void moveBottom(int pos);
void moveTopLeft(const QPoint &p);
void moveBottomRight(const QPoint &p);
void moveTopRight(const QPoint &p);
void moveBottomLeft(const QPoint &p);
void getRect(int *ax, int *ay, int *aw, int *ah) const;
void setRect(int ax, int ay, int aw, int ah);
void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const;
void setCoords(int xp1, int yp1, int xp2, int yp2);
QRect adjusted(int xp1, int yp1, int xp2, int yp2) const;
void adjust(int dx1, int dy1, int dx2, int dy2);
void setWidth(int w);
void setHeight(int h);
void setSize(const QSize &s);
bool contains(int ax, int ay, bool aproper) const;
bool contains(int ax, int ay) const;
QRect &operator|=(const QRect &r);
QRect &operator&=(const QRect &r);
QRect intersected(const QRect &other) const;
QRect united(const QRect &r) const;
QRect marginsAdded(const QMargins &margins) const;
QRect marginsRemoved(const QMargins &margins) const;
QRect &operator+=(const QMargins &margins);
QRect &operator-=(const QMargins &margins);
QRect transposed() const;
static QRect span(const QPoint &p1, const QPoint &p2);
%If (Qt_6_4_0 -)
QRectF toRectF() const;
%End
};
QDataStream &operator<<(QDataStream &, const QRect &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QRect & /Constrained/) /ReleaseGIL/;
%If (Qt_6_8_0 -)
bool operator==(const QRectF &lhs, const QRect &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QRect &lhs, const QRectF &rhs);
%End
bool operator==(const QRect &r1, const QRect &r2);
%If (Qt_6_8_0 -)
bool operator!=(const QRectF &lhs, const QRect &rhs);
%End
%If (Qt_6_8_0 -)
bool operator!=(const QRect &lhs, const QRectF &rhs);
%End
bool operator!=(const QRect &r1, const QRect &r2);
class QRectF
{
%TypeHeaderCode
#include <qrect.h>
%End
%PickleCode
sipRes = Py_BuildValue("dddd", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height());
%End
public:
QRectF();
QRectF(const QPointF &atopLeft, const QSizeF &asize);
QRectF(const QPointF &atopLeft, const QPointF &abottomRight);
QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight);
QRectF(const QRect &r);
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
if (sipCpp->isNull())
{
sipRes = PyUnicode_FromString("PyQt6.QtCore.QRectF()");
}
else
{
PyObject *l = PyFloat_FromDouble(sipCpp->left());
PyObject *t = PyFloat_FromDouble(sipCpp->top());
PyObject *w = PyFloat_FromDouble(sipCpp->width());
PyObject *h = PyFloat_FromDouble(sipCpp->height());
if (l && t && w && h)
sipRes = PyUnicode_FromFormat(
"PyQt6.QtCore.QRectF(%R, %R, %R, %R)", l, t, w, h);
Py_XDECREF(l);
Py_XDECREF(t);
Py_XDECREF(w);
Py_XDECREF(h);
}
%End
QRectF normalized() const;
qreal left() const;
qreal top() const;
qreal right() const;
qreal bottom() const;
void setX(qreal pos);
void setY(qreal pos);
QPointF topLeft() const;
QPointF bottomRight() const;
QPointF topRight() const;
QPointF bottomLeft() const;
QRectF operator|(const QRectF &r) const;
QRectF operator&(const QRectF &r) const;
bool contains(const QPointF &p) const;
int __contains__(const QPointF &p) const;
%MethodCode
sipRes = sipCpp->contains(*a0);
%End
bool contains(const QRectF &r) const;
int __contains__(const QRectF &r) const;
%MethodCode
sipRes = sipCpp->contains(*a0);
%End
bool intersects(const QRectF &r) const;
bool isNull() const;
bool isEmpty() const;
bool isValid() const;
int __bool__() const;
%MethodCode
sipRes = sipCpp->isValid();
%End
qreal x() const;
qreal y() const;
void setLeft(qreal pos);
void setRight(qreal pos);
void setTop(qreal pos);
void setBottom(qreal pos);
void setTopLeft(const QPointF &p);
void setTopRight(const QPointF &p);
void setBottomLeft(const QPointF &p);
void setBottomRight(const QPointF &p);
QPointF center() const;
void moveLeft(qreal pos);
void moveTop(qreal pos);
void moveRight(qreal pos);
void moveBottom(qreal pos);
void moveTopLeft(const QPointF &p);
void moveTopRight(const QPointF &p);
void moveBottomLeft(const QPointF &p);
void moveBottomRight(const QPointF &p);
void moveCenter(const QPointF &p);
qreal width() const;
qreal height() const;
QSizeF size() const;
void translate(qreal dx, qreal dy);
void translate(const QPointF &p);
void moveTo(qreal ax, qreal ay);
void moveTo(const QPointF &p);
QRectF translated(qreal dx, qreal dy) const;
QRectF translated(const QPointF &p) const;
void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const;
void setRect(qreal ax, qreal ay, qreal aaw, qreal aah);
void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const;
void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2);
void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2);
QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const;
void setWidth(qreal aw);
void setHeight(qreal ah);
void setSize(const QSizeF &s);
bool contains(qreal ax, qreal ay) const;
QRectF &operator|=(const QRectF &r);
QRectF &operator&=(const QRectF &r);
QRectF intersected(const QRectF &r) const;
QRectF united(const QRectF &r) const;
QRect toAlignedRect() const;
QRect toRect() const;
QRectF marginsAdded(const QMarginsF &margins) const;
QRectF marginsRemoved(const QMarginsF &margins) const;
QRectF &operator+=(const QMarginsF &margins);
QRectF &operator-=(const QMarginsF &margins);
QRectF transposed() const;
};
QDataStream &operator<<(QDataStream &, const QRectF &) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &, QRectF & /Constrained/) /ReleaseGIL/;
bool operator==(const QRectF &r1, const QRectF &r2);
bool operator!=(const QRectF &r1, const QRectF &r2);
QRect operator+(const QRect &rectangle, const QMargins &margins);
QRect operator+(const QMargins &margins, const QRect &rectangle);
QRect operator-(const QRect &lhs, const QMargins &rhs);
QRectF operator+(const QRectF &lhs, const QMarginsF &rhs);
QRectF operator+(const QMarginsF &lhs, const QRectF &rhs);
QRectF operator-(const QRectF &lhs, const QMarginsF &rhs);
%If (Qt_6_8_0 -)
bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs);
%End
%If (Qt_6_8_0 -)
bool qFuzzyIsNull(const QRectF &rect);
%End
@@ -0,0 +1,223 @@
// qregularexpression.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QRegularExpression
{
%TypeHeaderCode
#include <qregularexpression.h>
%End
public:
enum PatternOption /BaseType=Flag/
{
NoPatternOption,
CaseInsensitiveOption,
DotMatchesEverythingOption,
MultilineOption,
ExtendedPatternSyntaxOption,
InvertedGreedinessOption,
DontCaptureOption,
UseUnicodePropertiesOption,
};
typedef QFlags<QRegularExpression::PatternOption> PatternOptions;
QRegularExpression::PatternOptions patternOptions() const;
void setPatternOptions(QRegularExpression::PatternOptions options);
QRegularExpression();
QRegularExpression(const QString &pattern, QRegularExpression::PatternOptions options = QRegularExpression::NoPatternOption);
QRegularExpression(const QRegularExpression &re);
~QRegularExpression();
SIP_PYOBJECT __repr__() const /TypeHint="str"/;
%MethodCode
PyObject *uni = qpycore_PyObject_FromQString(sipCpp->pattern());
if (uni)
{
sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QRegularExpression(%R", uni);
if (sipCpp->patternOptions() != QRegularExpression::NoPatternOption)
{
qpycore_Unicode_ConcatAndDel(&sipRes,
PyUnicode_FromFormat(
", PyQt6.QtCore.QRegularExpression.PatternOptions(%i)",
(int)sipCpp->patternOptions()));
}
qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")"));
Py_DECREF(uni);
}
else
{
sipRes = 0;
}
%End
void swap(QRegularExpression &re /Constrained/);
QString pattern() const;
void setPattern(const QString &pattern);
bool isValid() const;
qsizetype patternErrorOffset() const;
QString errorString() const;
int captureCount() const;
enum MatchType
{
NormalMatch,
PartialPreferCompleteMatch,
PartialPreferFirstMatch,
NoMatch,
};
enum MatchOption /BaseType=Flag/
{
NoMatchOption,
AnchorAtOffsetMatchOption,
DontCheckSubjectStringMatchOption,
};
typedef QFlags<QRegularExpression::MatchOption> MatchOptions;
QRegularExpressionMatch match(const QString &subject, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const;
%If (Qt_6_5_0 -)
QRegularExpressionMatch matchView(QStringView subjectView, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const;
%End
QRegularExpressionMatchIterator globalMatch(const QString &subject, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const;
%If (Qt_6_5_0 -)
QRegularExpressionMatchIterator globalMatchView(QStringView subjectView, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const;
%End
static QString escape(const QString &str);
QStringList namedCaptureGroups() const;
%If (- Qt_6_8_0)
bool operator==(const QRegularExpression &re) const;
%End
%If (- Qt_6_8_0)
bool operator!=(const QRegularExpression &re) const;
%End
void optimize() const;
Py_hash_t __hash__() const;
%MethodCode
sipRes = qHash(*sipCpp);
%End
static QString wildcardToRegularExpression(QStringView str, QRegularExpression::WildcardConversionOptions options = QRegularExpression::DefaultWildcardConversion);
static QString anchoredPattern(const QString &expression);
enum WildcardConversionOption /BaseType=Flag/
{
DefaultWildcardConversion,
UnanchoredWildcardConversion,
%If (Qt_6_6_0 -)
NonPathWildcardConversion,
%End
};
typedef QFlags<QRegularExpression::WildcardConversionOption> WildcardConversionOptions;
static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs = Qt::CaseInsensitive, QRegularExpression::WildcardConversionOptions options = QRegularExpression::DefaultWildcardConversion);
};
QDataStream &operator<<(QDataStream &out, const QRegularExpression &re /Constrained/) /ReleaseGIL/;
QDataStream &operator>>(QDataStream &in, QRegularExpression &re /Constrained/) /ReleaseGIL/;
class QRegularExpressionMatch
{
%TypeHeaderCode
#include <qregularexpression.h>
%End
public:
QRegularExpressionMatch();
~QRegularExpressionMatch();
QRegularExpressionMatch(const QRegularExpressionMatch &match);
void swap(QRegularExpressionMatch &match /Constrained/);
QRegularExpression regularExpression() const;
QRegularExpression::MatchType matchType() const;
QRegularExpression::MatchOptions matchOptions() const;
bool hasMatch() const;
bool hasPartialMatch() const;
bool isValid() const;
int lastCapturedIndex() const;
QString captured(int nth = 0) const;
%If (- Qt_6_8_0)
QString captured(const QString &name) const;
%End
%If (Qt_6_8_0 -)
QString captured(QAnyStringView name) const;
%End
QStringList capturedTexts() const;
%If (- Qt_6_8_0)
qsizetype capturedStart(QStringView name) const;
%End
%If (Qt_6_8_0 -)
qsizetype capturedStart(QAnyStringView name) const;
%End
qsizetype capturedStart(int nth = 0) const;
%If (- Qt_6_8_0)
qsizetype capturedLength(QStringView name) const;
%End
%If (Qt_6_8_0 -)
qsizetype capturedLength(QAnyStringView name) const;
%End
qsizetype capturedLength(int nth = 0) const;
%If (- Qt_6_8_0)
qsizetype capturedEnd(QStringView name) const;
%End
%If (Qt_6_8_0 -)
qsizetype capturedEnd(QAnyStringView name) const;
%End
qsizetype capturedEnd(int nth = 0) const;
%If (Qt_6_3_0 -)
bool hasCaptured(int nth) const;
%End
%If (Qt_6_3_0 - Qt_6_8_0)
bool hasCaptured(const QString &name) const;
%End
%If (Qt_6_8_0 -)
bool hasCaptured(QAnyStringView name) const;
%End
};
class QRegularExpressionMatchIterator
{
%TypeHeaderCode
#include <qregularexpression.h>
%End
public:
QRegularExpressionMatchIterator();
~QRegularExpressionMatchIterator();
QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator);
void swap(QRegularExpressionMatchIterator &iterator /Constrained/);
bool isValid() const;
bool hasNext() const;
QRegularExpressionMatch next();
QRegularExpressionMatch peekNext() const;
QRegularExpression regularExpression() const;
QRegularExpression::MatchType matchType() const;
QRegularExpression::MatchOptions matchOptions() const;
};
%If (Qt_6_8_0 -)
bool operator!=(const QRegularExpression &lhs, const QRegularExpression &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QRegularExpression &lhs, const QRegularExpression &rhs);
%End
@@ -0,0 +1,81 @@
// qresource.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QResource
{
%TypeHeaderCode
#include <qresource.h>
%End
public:
QResource(const QString &fileName = QString(), const QLocale &locale = QLocale());
~QResource();
QString absoluteFilePath() const;
SIP_PYOBJECT data() const /TypeHint="bytes"/;
%MethodCode
// The data may contain embedded '\0's so set the size explicitly.
if (sipCpp->data())
{
if ((sipRes = PyBytes_FromStringAndSize((char *)sipCpp->data(), sipCpp->size())) == NULL)
sipIsErr = 1;
}
else
{
Py_INCREF(Py_None);
sipRes = Py_None;
}
%End
QString fileName() const;
bool isValid() const;
QLocale locale() const;
void setFileName(const QString &file);
void setLocale(const QLocale &locale);
qint64 size() const;
static bool registerResource(const QString &rccFileName, const QString &mapRoot = QString());
static bool registerResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=registerResourceData/;
static bool unregisterResource(const QString &rccFileName, const QString &mapRoot = QString());
static bool unregisterResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=unregisterResourceData/;
protected:
QStringList children() const;
bool isDir() const;
bool isFile() const;
public:
QDateTime lastModified() const;
enum Compression
{
NoCompression,
ZlibCompression,
ZstdCompression,
};
QResource::Compression compressionAlgorithm() const;
qint64 uncompressedSize() const;
QByteArray uncompressedData() const;
private:
QResource(const QResource &);
};
@@ -0,0 +1,55 @@
// qrunnable.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QRunnable /Supertype=PyQt6.sip.wrapper/
{
%TypeHeaderCode
#include <qrunnable.h>
%End
public:
QRunnable();
virtual ~QRunnable();
virtual void run() = 0 /NewThread/;
bool autoDelete() const;
void setAutoDelete(bool _autoDelete);
static QRunnable *create(SIP_PYCALLABLE functionToRun /KeepReference,TypeHint="Callable[[], None]"/) /Factory/;
%MethodCode
sipRes = QRunnable::create([a0]() {
SIP_BLOCK_THREADS
PyObject *res;
res = PyObject_CallObject(a0, NULL);
if (res)
Py_DECREF(res);
else
pyqt6_err_print();
SIP_UNBLOCK_THREADS
});
%End
private:
QRunnable(const QRunnable &);
};
@@ -0,0 +1,70 @@
// qsavefile.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QSaveFile : public QFileDevice
{
%TypeHeaderCode
#include <qsavefile.h>
%End
public:
explicit QSaveFile(const QString &name);
explicit QSaveFile(QObject *parent /TransferThis/ = 0);
QSaveFile(const QString &name, QObject *parent /TransferThis/);
virtual ~QSaveFile();
virtual QString fileName() const;
void setFileName(const QString &name);
virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/;
bool commit();
void cancelWriting();
void setDirectWriteFallback(bool enabled);
bool directWriteFallback() const;
protected:
virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)];
%MethodCode
sipBufferInfoDef bi;
if (sipGetBufferInfo(a0, &bi) > 0)
{
Py_BEGIN_ALLOW_THREADS
#if defined(SIP_PROTECTED_IS_PUBLIC)
sipRes = sipSelfWasArg ?
sipCpp->QSaveFile::writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len) :
sipCpp->writeData(reinterpret_cast<char *>(bi.bi_buf), bi.bi_len);
#else
sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast<char *>(bi.bi_buf),
bi.bi_len);
#endif
Py_END_ALLOW_THREADS
sipReleaseBufferInfo(&bi);
}
else
{
sipIsErr = 1;
}
%End
private:
virtual void close();
};
@@ -0,0 +1,58 @@
// qsemaphore.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QSemaphore
{
%TypeHeaderCode
#include <qsemaphore.h>
%End
public:
explicit QSemaphore(int n = 0);
~QSemaphore();
void acquire(int n = 1) /ReleaseGIL/;
bool tryAcquire(int n = 1);
%If (Qt_6_6_0 -)
bool tryAcquire(int n, QDeadlineTimer timeout) /ReleaseGIL/;
%End
bool tryAcquire(int n, int timeout) /ReleaseGIL/;
void release(int n = 1);
int available() const;
private:
QSemaphore(const QSemaphore &);
};
class QSemaphoreReleaser /NoDefaultCtors/
{
%TypeHeaderCode
#include <qsemaphore.h>
%End
public:
QSemaphoreReleaser();
QSemaphoreReleaser(QSemaphore *sem, int n = 1);
~QSemaphoreReleaser();
void swap(QSemaphoreReleaser &other);
QSemaphore *semaphore() const;
QSemaphore *cancel();
};
@@ -0,0 +1,45 @@
// qsequentialanimationgroup.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QSequentialAnimationGroup : public QAnimationGroup
{
%TypeHeaderCode
#include <qsequentialanimationgroup.h>
%End
public:
QSequentialAnimationGroup(QObject *parent /TransferThis/ = 0);
virtual ~QSequentialAnimationGroup();
QPauseAnimation *addPause(int msecs);
QPauseAnimation *insertPause(int index, int msecs);
QAbstractAnimation *currentAnimation() const;
virtual int duration() const;
signals:
void currentAnimationChanged(QAbstractAnimation *current);
protected:
virtual bool event(QEvent *event);
virtual void updateCurrentTime(int);
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
virtual void updateDirection(QAbstractAnimation::Direction direction);
};
@@ -0,0 +1,153 @@
// qsettings.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QSettings : public QObject
{
%TypeHeaderCode
#include <qsettings.h>
%End
public:
enum Status
{
NoError,
AccessError,
FormatError,
};
enum Format
{
NativeFormat,
IniFormat,
InvalidFormat,
};
enum Scope
{
UserScope,
SystemScope,
};
QSettings(const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
QSettings(QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
QSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
QSettings(const QString &fileName, QSettings::Format format, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
QSettings(QSettings::Scope scope, QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
explicit QSettings(QObject *parent /TransferThis/ = 0) /ReleaseGIL/;
virtual ~QSettings() /ReleaseGIL/;
void clear() /ReleaseGIL/;
void sync() /ReleaseGIL/;
QSettings::Status status() const;
%If (Qt_6_4_0 -)
void beginGroup(QAnyStringView prefix);
%End
%If (- Qt_6_4_0)
void beginGroup(const QString &prefix);
%End
void endGroup();
QString group() const;
%If (Qt_6_4_0 -)
int beginReadArray(QAnyStringView prefix);
%End
%If (- Qt_6_4_0)
int beginReadArray(const QString &prefix);
%End
%If (Qt_6_4_0 -)
void beginWriteArray(QAnyStringView prefix, int size = -1);
%End
%If (- Qt_6_4_0)
void beginWriteArray(const QString &prefix, int size = -1);
%End
void endArray();
void setArrayIndex(int i);
QStringList allKeys() const /ReleaseGIL/;
QStringList childKeys() const /ReleaseGIL/;
QStringList childGroups() const /ReleaseGIL/;
bool isWritable() const;
%If (Qt_6_4_0 -)
void setValue(QAnyStringView key, const QVariant &value) /ReleaseGIL/;
%End
%If (- Qt_6_4_0)
void setValue(const QString &key, const QVariant &value) /ReleaseGIL/;
%End
%If (Qt_6_4_0 -)
SIP_PYOBJECT value(const QAnyStringView &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/;
%MethodCode
QVariant value;
// QSettings has an internal mutex so release the GIL to avoid the possibility
// of deadlocks.
Py_BEGIN_ALLOW_THREADS
value = sipCpp->value(*a0, *a1);
Py_END_ALLOW_THREADS
sipRes = pyqt6_from_qvariant_by_type(value, a2);
sipIsErr = !sipRes;
%End
%End
%If (- Qt_6_4_0)
SIP_PYOBJECT value(const QString &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/;
%MethodCode
QVariant value;
// QSettings has an internal mutex so release the GIL to avoid the possibility
// of deadlocks.
Py_BEGIN_ALLOW_THREADS
value = sipCpp->value(*a0, *a1);
Py_END_ALLOW_THREADS
sipRes = pyqt6_from_qvariant_by_type(value, a2);
sipIsErr = !sipRes;
%End
%End
%If (Qt_6_4_0 -)
void remove(QAnyStringView key) /ReleaseGIL/;
%End
%If (- Qt_6_4_0)
void remove(const QString &key) /ReleaseGIL/;
%End
%If (Qt_6_4_0 -)
bool contains(QAnyStringView key) const /ReleaseGIL/;
%End
%If (- Qt_6_4_0)
bool contains(const QString &key) const /ReleaseGIL/;
%End
void setFallbacksEnabled(bool b);
bool fallbacksEnabled() const;
QString fileName() const;
static void setPath(QSettings::Format format, QSettings::Scope scope, const QString &path) /ReleaseGIL/;
QSettings::Format format() const;
QSettings::Scope scope() const;
QString organizationName() const;
QString applicationName() const;
static void setDefaultFormat(QSettings::Format format);
static QSettings::Format defaultFormat();
bool isAtomicSyncRequired() const;
void setAtomicSyncRequired(bool enable);
protected:
virtual bool event(QEvent *event);
};
@@ -0,0 +1,98 @@
// qsharedmemory.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of PyQt6.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
class QSharedMemory : public QObject
{
%TypeHeaderCode
#include <qsharedmemory.h>
%End
public:
enum AccessMode
{
ReadOnly,
ReadWrite,
};
enum SharedMemoryError
{
NoError,
PermissionDenied,
InvalidSize,
KeyError,
AlreadyExists,
NotFound,
LockError,
OutOfResources,
UnknownError,
};
QSharedMemory(QObject *parent /TransferThis/ = 0);
%If (Qt_6_6_0 -)
QSharedMemory(const QNativeIpcKey &key, QObject *parent /TransferThis/ = 0);
%End
QSharedMemory(const QString &key, QObject *parent /TransferThis/ = 0);
virtual ~QSharedMemory();
void setKey(const QString &key);
QString key() const;
bool create(qsizetype size, QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite);
qsizetype size() const;
bool attach(QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite);
bool isAttached() const;
bool detach();
SIP_PYOBJECT data() /TypeHint="PyQt6.sip.voidptr"/;
%MethodCode
sipRes = sipConvertFromVoidPtrAndSize(sipCpp->data(), sipCpp->size());
%End
SIP_PYOBJECT constData() const /TypeHint="PyQt6.sip.voidptr"/;
%MethodCode
sipRes = sipConvertFromConstVoidPtrAndSize(sipCpp->constData(), sipCpp->size());
%End
bool lock();
bool unlock();
QSharedMemory::SharedMemoryError error() const;
QString errorString() const;
%If (Qt_6_6_0 -)
void setNativeKey(const QNativeIpcKey &key);
%End
%If (Qt_6_6_0 -)
void setNativeKey(const QString &key, QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs());
%End
%If (- Qt_6_6_0)
void setNativeKey(const QString &key);
%End
QString nativeKey() const;
%If (Qt_6_6_0 -)
QNativeIpcKey nativeIpcKey() const;
%End
%If (Qt_6_6_0 -)
static bool isKeyTypeSupported(QNativeIpcKey::Type type);
%End
%If (Qt_6_6_0 -)
static QNativeIpcKey platformSafeKey(const QString &key, QNativeIpcKey::Type type = QNativeIpcKey::DefaultTypeForOs);
%End
%If (Qt_6_6_0 -)
static QNativeIpcKey legacyNativeKey(const QString &key, QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs());
%End
};
Loaded 100 of 6110 files, more files were not shown because too many files have changed in this diff. Show more