/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//workaround to access protected functions
#define protected public

// default includes
#include <shiboken.h>
#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QDebug>
#include <pysidesignal.h>
#include <pysideproperty.h>
#include <pyside.h>
#include <pysideqenum.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED

#include <typeinfo>
#include <iterator>

// module include
#include "pyside6_qtopengl_python.h"

// main header
#include "qopenglpaintdevice_wrapper.h"

// inner classes

#include <cctype>
#include <cstring>



template <class T>
static const char *typeNameOf(const T &t)
{
    const char *typeName =  typeid(t).name();
    auto size = std::strlen(typeName);
#if defined(Q_CC_MSVC) // MSVC: "class QPaintDevice * __ptr64"
    if (auto lastStar = strchr(typeName, '*')) {
        // MSVC: "class QPaintDevice * __ptr64"
        while (*--lastStar == ' ') {
        }
        size = lastStar - typeName + 1;
    }
#else // g++, Clang: "QPaintDevice *" -> "P12QPaintDevice"
    if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) {
        ++typeName;
        --size;
    }
#endif
    char *result = new char[size + 1];
    result[size] = '\0';
    memcpy(result, typeName, size);
    return result;
}

// Native ---------------------------------------------------------

void QOpenGLPaintDeviceWrapper::resetPyMethodCache()
{
    std::fill_n(m_PyMethodCache, sizeof(m_PyMethodCache) / sizeof(m_PyMethodCache[0]), false);
}

QOpenGLPaintDeviceWrapper::QOpenGLPaintDeviceWrapper() : QOpenGLPaintDevice()
{
    resetPyMethodCache();
    // ... middle
}

QOpenGLPaintDeviceWrapper::QOpenGLPaintDeviceWrapper(const QSize & size) : QOpenGLPaintDevice(size)
{
    resetPyMethodCache();
    // ... middle
}

QOpenGLPaintDeviceWrapper::QOpenGLPaintDeviceWrapper(int width, int height) : QOpenGLPaintDevice(width, height)
{
    resetPyMethodCache();
    // ... middle
}

int QOpenGLPaintDeviceWrapper::devType() const
{
    if (m_PyMethodCache[0])
        return this->::QOpenGLPaintDevice::devType();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "devType";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[0] = true;
        return this->::QOpenGLPaintDevice::devType();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QOpenGLPaintDevice.devType",
            "int",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    int cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

void QOpenGLPaintDeviceWrapper::ensureActiveTarget()
{
    if (m_PyMethodCache[1]) {
        return this->::QOpenGLPaintDevice::ensureActiveTarget();
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "ensureActiveTarget";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[1] = true;
        return this->::QOpenGLPaintDevice::ensureActiveTarget();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

void QOpenGLPaintDeviceWrapper::initPainter(QPainter * painter) const
{
    if (m_PyMethodCache[2]) {
        return this->::QPaintDevice::initPainter(painter);
    }
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "initPainter";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[2] = true;
        return this->::QPaintDevice::initPainter(painter);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtGuiTypes[SBK_QPAINTER_IDX], painter)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return;
    }
}

int QOpenGLPaintDeviceWrapper::metric(QPaintDevice::PaintDeviceMetric metric) const
{
    if (m_PyMethodCache[3])
        return this->::QOpenGLPaintDevice::metric(metric);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return 0;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "metric";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[3] = true;
        return this->::QOpenGLPaintDevice::metric(metric);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::copyToPython(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtGuiTypes[SBK_QPAINTDEVICE_PAINTDEVICEMETRIC_IDX]))->converter, &metric)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return 0;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QOpenGLPaintDevice.metric",
            "int",
            Py_TYPE(pyResult)->tp_name);
        return 0;
    }
    int cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

QPaintEngine * QOpenGLPaintDeviceWrapper::paintEngine() const
{
    if (m_PyMethodCache[4])
        return this->::QOpenGLPaintDevice::paintEngine();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return nullptr;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "paintEngine";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[4] = true;
        return this->::QOpenGLPaintDevice::paintEngine();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return nullptr;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QPAINTENGINE_IDX], pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QOpenGLPaintDevice.paintEngine",
            reinterpret_cast<PyTypeObject *>(Shiboken::SbkType< QPaintEngine >())->tp_name,
            Py_TYPE(pyResult)->tp_name);
        return nullptr;
    }
    ::QPaintEngine *cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

QPaintDevice * QOpenGLPaintDeviceWrapper::redirected(QPoint * offset) const
{
    if (m_PyMethodCache[5])
        return this->::QPaintDevice::redirected(offset);
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return nullptr;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "redirected";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[5] = true;
        return this->::QPaintDevice::redirected(offset);
    }

    Shiboken::AutoDecRef pyArgs(Py_BuildValue("(N)",
        Shiboken::Conversions::pointerToPython(SbkPySide6_QtCoreTypes[SBK_QPOINT_IDX], offset)
    ));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return nullptr;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QPAINTDEVICE_IDX], pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QOpenGLPaintDevice.redirected",
            reinterpret_cast<PyTypeObject *>(Shiboken::SbkType< QPaintDevice >())->tp_name,
            Py_TYPE(pyResult)->tp_name);
        return nullptr;
    }
    ::QPaintDevice *cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

QPainter * QOpenGLPaintDeviceWrapper::sharedPainter() const
{
    if (m_PyMethodCache[6])
        return this->::QPaintDevice::sharedPainter();
    Shiboken::GilState gil;
    if (PyErr_Occurred())
        return nullptr;
    static PyObject *nameCache[2] = {};
    static const char *funcName = "sharedPainter";
    Shiboken::AutoDecRef pyOverride(Shiboken::BindingManager::instance().getOverride(this, nameCache, funcName));
    if (pyOverride.isNull()) {
        gil.release();
        m_PyMethodCache[6] = true;
        return this->::QPaintDevice::sharedPainter();
    }

    Shiboken::AutoDecRef pyArgs(PyTuple_New(0));

    Shiboken::AutoDecRef pyResult(PyObject_Call(pyOverride, pyArgs, nullptr));
    if (pyResult.isNull()) {
        // An error happened in python code!
        PyErr_Print();
        return nullptr;
    }
    // Check return type
    Shiboken::Conversions::PythonToCppConversion pythonToCpp =
        Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QPAINTER_IDX], pyResult);
    if (!pythonToCpp) {
        Shiboken::warning(PyExc_RuntimeWarning, 2,
            "Invalid return value in function %s, expected %s, got %s.",
            "QOpenGLPaintDevice.sharedPainter",
            reinterpret_cast<PyTypeObject *>(Shiboken::SbkType< QPainter >())->tp_name,
            Py_TYPE(pyResult)->tp_name);
        return nullptr;
    }
    ::QPainter *cppResult;
    pythonToCpp(pyResult, &cppResult);
    return cppResult;
}

QOpenGLPaintDeviceWrapper::~QOpenGLPaintDeviceWrapper()
{
    SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);
    Shiboken::Object::destroy(wrapper, this);
}

// Target ---------------------------------------------------------

extern "C" {
static int
Sbk_QOpenGLPaintDevice_Init(PyObject *self, PyObject *args, PyObject *kwds)
{
    SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
    PySide::Feature::Select(self);
    if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType< ::QOpenGLPaintDevice >()))
        return -1;

    ::QOpenGLPaintDeviceWrapper *cptr{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.__init__";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    SBK_UNUSED(pythonToCpp)
    const Py_ssize_t numArgs = PyTuple_GET_SIZE(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {0, 0};

    // invalid argument lengths


    if (!PyArg_UnpackTuple(args, "QOpenGLPaintDevice", 0, 2, &(pyArgs[0]), &(pyArgs[1])))
        return -1;


    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::QOpenGLPaintDevice()
    // 1: QOpenGLPaintDevice::QOpenGLPaintDevice(QSize)
    // 2: QOpenGLPaintDevice::QOpenGLPaintDevice(int,int)
    if (numArgs == 0) {
        overloadId = 0; // QOpenGLPaintDevice()
    } else if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<int>(), (pyArgs[1])))) {
        overloadId = 2; // QOpenGLPaintDevice(int,int)
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtCoreTypes[SBK_QSIZE_IDX], (pyArgs[0])))) {
        overloadId = 1; // QOpenGLPaintDevice(QSize)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDevice_Init_TypeError;

    // Call function/method
    switch (overloadId) {
        case 0: // QOpenGLPaintDevice()
        {

            if (!PyErr_Occurred()) {
                // QOpenGLPaintDevice()
                cptr = new ::QOpenGLPaintDeviceWrapper();
            }
            break;
        }
        case 1: // QOpenGLPaintDevice(const QSize & size)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QSize cppArg0_local;
            ::QSize *cppArg0 = &cppArg0_local;
            if (pythonToCpp[0].isValue())
                pythonToCpp[0](pyArgs[0], &cppArg0_local);
            else
                pythonToCpp[0](pyArgs[0], &cppArg0);


            if (!PyErr_Occurred()) {
                // QOpenGLPaintDevice(QSize)
                cptr = new ::QOpenGLPaintDeviceWrapper(*cppArg0);
            }
            break;
        }
        case 2: // QOpenGLPaintDevice(int width, int height)
        {
            int cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);
            int cppArg1;
            pythonToCpp[1](pyArgs[1], &cppArg1);

            if (!PyErr_Occurred()) {
                // QOpenGLPaintDevice(int,int)
                cptr = new ::QOpenGLPaintDeviceWrapper(cppArg0, cppArg1);
            }
            break;
        }
    }

    if (PyErr_Occurred() || !Shiboken::Object::setCppPointer(sbkSelf, Shiboken::SbkType< ::QOpenGLPaintDevice >(), cptr)) {
        delete cptr;
        return -1;
    }
    if (!cptr) goto Sbk_QOpenGLPaintDevice_Init_TypeError;

    Shiboken::Object::setValidCpp(sbkSelf, true);
    Shiboken::Object::setHasCppWrapper(sbkSelf, true);
    if (Shiboken::BindingManager::instance().hasWrapper(cptr)) {
        Shiboken::BindingManager::instance().releaseWrapper(Shiboken::BindingManager::instance().retrieveWrapper(cptr));
    }
    Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr);


    return 1;

    Sbk_QOpenGLPaintDevice_Init_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return -1;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_context(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.context";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // context()const
            QOpenGLContext * cppResult = const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->context();
            pyResult = Shiboken::Conversions::pointerToPython(SbkPySide6_QtGuiTypes[SBK_QOPENGLCONTEXT_IDX], cppResult);
            Shiboken::Object::setParent(self, pyResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_devType(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.devType";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // devType()const
            int cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->::QOpenGLPaintDevice::devType()
                : const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->devType();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_dotsPerMeterX(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.dotsPerMeterX";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // dotsPerMeterX()const
            qreal cppResult = const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->dotsPerMeterX();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_dotsPerMeterY(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.dotsPerMeterY";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // dotsPerMeterY()const
            qreal cppResult = const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->dotsPerMeterY();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_ensureActiveTarget(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.ensureActiveTarget";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // ensureActiveTarget()
            Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? cppSelf->::QOpenGLPaintDevice::ensureActiveTarget()
                : cppSelf->ensureActiveTarget();
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_metric(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.metric";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QPaintDevice::metric(QPaintDevice::PaintDeviceMetric)const->int
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(PepType_SETP(reinterpret_cast<SbkEnumType *>(SbkPySide6_QtGuiTypes[SBK_QPAINTDEVICE_PAINTDEVICEMETRIC_IDX]))->converter, (pyArg)))) {
        overloadId = 0; // metric(QPaintDevice::PaintDeviceMetric)const
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_metric_TypeError;

    // Call function/method
    {
        ::QPaintDevice::PaintDeviceMetric cppArg0 = static_cast< ::QPaintDevice::PaintDeviceMetric>(0);
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // metric(QPaintDevice::PaintDeviceMetric)const
            int cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->::QOpenGLPaintDevice::metric(cppArg0)
                : const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->metric(cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;

    Sbk_QOpenGLPaintDeviceFunc_metric_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_paintEngine(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.paintEngine";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // paintEngine()const
            QPaintEngine * cppResult = Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))
                ? const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->::QOpenGLPaintDevice::paintEngine()
                : const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->paintEngine();
            pyResult = Shiboken::Conversions::pointerToPython(SbkPySide6_QtGuiTypes[SBK_QPAINTENGINE_IDX], cppResult);
            Shiboken::Object::setParent(self, pyResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_paintFlipped(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.paintFlipped";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // paintFlipped()const
            bool cppResult = const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->paintFlipped();
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_setDevicePixelRatio(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.setDevicePixelRatio";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::setDevicePixelRatio(qreal)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), (pyArg)))) {
        overloadId = 0; // setDevicePixelRatio(qreal)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_setDevicePixelRatio_TypeError;

    // Call function/method
    {
        qreal cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setDevicePixelRatio(qreal)
            cppSelf->setDevicePixelRatio(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QOpenGLPaintDeviceFunc_setDevicePixelRatio_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterX(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.setDotsPerMeterX";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::setDotsPerMeterX(qreal)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), (pyArg)))) {
        overloadId = 0; // setDotsPerMeterX(qreal)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterX_TypeError;

    // Call function/method
    {
        qreal cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setDotsPerMeterX(qreal)
            cppSelf->setDotsPerMeterX(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterX_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterY(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.setDotsPerMeterY";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::setDotsPerMeterY(qreal)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), (pyArg)))) {
        overloadId = 0; // setDotsPerMeterY(qreal)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterY_TypeError;

    // Call function/method
    {
        qreal cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setDotsPerMeterY(qreal)
            cppSelf->setDotsPerMeterY(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterY_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_setPaintFlipped(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.setPaintFlipped";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::setPaintFlipped(bool)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(Shiboken::Conversions::PrimitiveTypeConverter<bool>(), (pyArg)))) {
        overloadId = 0; // setPaintFlipped(bool)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_setPaintFlipped_TypeError;

    // Call function/method
    {
        bool cppArg0;
        pythonToCpp(pyArg, &cppArg0);

        if (!PyErr_Occurred()) {
            // setPaintFlipped(bool)
            cppSelf->setPaintFlipped(cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QOpenGLPaintDeviceFunc_setPaintFlipped_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_setSize(PyObject *self, PyObject *pyArg)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.setSize";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: QOpenGLPaintDevice::setSize(QSize)
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtCoreTypes[SBK_QSIZE_IDX], (pyArg)))) {
        overloadId = 0; // setSize(QSize)
    }

    // Function signature not found.
    if (overloadId == -1) goto Sbk_QOpenGLPaintDeviceFunc_setSize_TypeError;

    // Call function/method
    {
        if (!Shiboken::Object::isValid(pyArg))
            return {};
        ::QSize cppArg0_local;
        ::QSize *cppArg0 = &cppArg0_local;
        if (pythonToCpp.isValue())
            pythonToCpp(pyArg, &cppArg0_local);
        else
            pythonToCpp(pyArg, &cppArg0);


        if (!PyErr_Occurred()) {
            // setSize(QSize)
            cppSelf->setSize(*cppArg0);
        }
    }

    if (PyErr_Occurred()) {
        return {};
    }
    Py_RETURN_NONE;

    Sbk_QOpenGLPaintDeviceFunc_setSize_TypeError:
        Shiboken::setErrorAboutWrongArguments(pyArg, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QOpenGLPaintDeviceFunc_size(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtOpenGL.QOpenGLPaintDevice.size";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // size()const
            QSize cppResult = const_cast<const ::QOpenGLPaintDevice *>(cppSelf)->size();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypes[SBK_QSIZE_IDX], &cppResult);
        }
    }

    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


static const char *Sbk_QOpenGLPaintDevice_PropertyStrings[] = {
    nullptr // Sentinel
};

static PyMethodDef Sbk_QOpenGLPaintDevice_methods[] = {
    {"context", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_context), METH_NOARGS},
    {"devType", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_devType), METH_NOARGS},
    {"dotsPerMeterX", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_dotsPerMeterX), METH_NOARGS},
    {"dotsPerMeterY", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_dotsPerMeterY), METH_NOARGS},
    {"ensureActiveTarget", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_ensureActiveTarget), METH_NOARGS},
    {"metric", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_metric), METH_O},
    {"paintEngine", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_paintEngine), METH_NOARGS},
    {"paintFlipped", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_paintFlipped), METH_NOARGS},
    {"setDevicePixelRatio", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_setDevicePixelRatio), METH_O},
    {"setDotsPerMeterX", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterX), METH_O},
    {"setDotsPerMeterY", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_setDotsPerMeterY), METH_O},
    {"setPaintFlipped", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_setPaintFlipped), METH_O},
    {"setSize", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_setSize), METH_O},
    {"size", reinterpret_cast<PyCFunction>(Sbk_QOpenGLPaintDeviceFunc_size), METH_NOARGS},

    {nullptr, nullptr} // Sentinel
};

static int Sbk_QOpenGLPaintDevice_setattro(PyObject *self, PyObject *name, PyObject *value)
{
    PySide::Feature::Select(self);
    if (value && PyCallable_Check(value)) {
        auto plain_inst = reinterpret_cast< ::QOpenGLPaintDevice *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX], reinterpret_cast<SbkObject *>(self)));
        auto inst = dynamic_cast<QOpenGLPaintDeviceWrapper *>(plain_inst);
        if (inst)
            inst->resetPyMethodCache();
    }
    return PyObject_GenericSetAttr(self, name, value);
}

} // extern "C"

static int Sbk_QOpenGLPaintDevice_traverse(PyObject *self, visitproc visit, void *arg)
{
    return SbkObject_TypeF()->tp_traverse(self, visit, arg);
}
static int Sbk_QOpenGLPaintDevice_clear(PyObject *self)
{
    return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);
}
// Class Definition -----------------------------------------------
extern "C" {
static PyTypeObject *_Sbk_QOpenGLPaintDevice_Type = nullptr;
static PyTypeObject *Sbk_QOpenGLPaintDevice_TypeF(void)
{
    return _Sbk_QOpenGLPaintDevice_Type;
}

static PyType_Slot Sbk_QOpenGLPaintDevice_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(&SbkDeallocWrapper)},
    {Py_tp_repr,        nullptr},
    {Py_tp_hash,        nullptr},
    {Py_tp_call,        nullptr},
    {Py_tp_str,         nullptr},
    {Py_tp_getattro,    nullptr},
    {Py_tp_setattro,    reinterpret_cast<void *>(Sbk_QOpenGLPaintDevice_setattro)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QOpenGLPaintDevice_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QOpenGLPaintDevice_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QOpenGLPaintDevice_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QOpenGLPaintDevice_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QOpenGLPaintDevice_spec = {
    "2:PySide6.QtOpenGL.QOpenGLPaintDevice",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QOpenGLPaintDevice_slots
};

} //extern "C"

static void *Sbk_QOpenGLPaintDevice_typeDiscovery(void *cptr, PyTypeObject *instanceType)
{
    if (instanceType == Shiboken::SbkType< ::QPaintDevice >())
        return dynamic_cast< ::QOpenGLPaintDevice *>(reinterpret_cast< ::QPaintDevice *>(cptr));
    return {};
}


// Type conversion functions.

// Python to C++ pointer conversion - returns the C++ object of the Python wrapper (keeps object identity).
static void QOpenGLPaintDevice_PythonToCpp_QOpenGLPaintDevice_PTR(PyObject *pyIn, void *cppOut)
{
    Shiboken::Conversions::pythonToCppPointer(Sbk_QOpenGLPaintDevice_TypeF(), pyIn, cppOut);
}
static PythonToCppFunc is_QOpenGLPaintDevice_PythonToCpp_QOpenGLPaintDevice_PTR_Convertible(PyObject *pyIn)
{
    if (pyIn == Py_None)
        return Shiboken::Conversions::nonePythonToCppNullPtr;
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QOpenGLPaintDevice_TypeF())))
        return QOpenGLPaintDevice_PythonToCpp_QOpenGLPaintDevice_PTR;
    return {};
}

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QOpenGLPaintDevice_PTR_CppToPython_QOpenGLPaintDevice(const void *cppIn)
{
    auto pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));
    if (pyOut) {
        Py_INCREF(pyOut);
        return pyOut;
    }
    bool changedTypeName = false;
    auto tCppIn = reinterpret_cast<const ::QOpenGLPaintDevice *>(cppIn);
    const char *typeName = typeid(*tCppIn).name();
    auto sbkType = Shiboken::ObjectType::typeForTypeName(typeName);
    if (sbkType && Shiboken::ObjectType::hasSpecialCastFunction(sbkType)) {
        typeName = typeNameOf(tCppIn);
        changedTypeName = true;
    }
    PyObject *result = Shiboken::Object::newObject(Sbk_QOpenGLPaintDevice_TypeF(), const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);
    if (changedTypeName)
        delete [] typeName;
    return result;
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QOpenGLPaintDevice_SignatureStrings[] = {
    "2:PySide6.QtOpenGL.QOpenGLPaintDevice(self)",
    "1:PySide6.QtOpenGL.QOpenGLPaintDevice(self,size:PySide6.QtCore.QSize)",
    "0:PySide6.QtOpenGL.QOpenGLPaintDevice(self,width:int,height:int)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.context(self)->PySide6.QtGui.QOpenGLContext",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.devType(self)->int",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.dotsPerMeterX(self)->qreal",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.dotsPerMeterY(self)->qreal",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.ensureActiveTarget(self)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.metric(self,metric:PySide6.QtGui.QPaintDevice.PaintDeviceMetric)->int",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.paintEngine(self)->PySide6.QtGui.QPaintEngine",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.paintFlipped(self)->bool",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.setDevicePixelRatio(self,devicePixelRatio:qreal)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.setDotsPerMeterX(self,arg__1:qreal)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.setDotsPerMeterY(self,arg__1:qreal)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.setPaintFlipped(self,flipped:bool)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.setSize(self,size:PySide6.QtCore.QSize)",
    "PySide6.QtOpenGL.QOpenGLPaintDevice.size(self)->PySide6.QtCore.QSize",
    nullptr}; // Sentinel

void init_QOpenGLPaintDevice(PyObject *module)
{
    _Sbk_QOpenGLPaintDevice_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QOpenGLPaintDevice",
        "QOpenGLPaintDevice*",
        &Sbk_QOpenGLPaintDevice_spec,
        &Shiboken::callCppDestructor< ::QOpenGLPaintDevice >,
        SbkPySide6_QtGuiTypes[SBK_QPAINTDEVICE_IDX],
        0,
        0);
    auto *pyType = Sbk_QOpenGLPaintDevice_TypeF(); // references _Sbk_QOpenGLPaintDevice_Type
    InitSignatureStrings(pyType, QOpenGLPaintDevice_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QOpenGLPaintDevice_Type), Sbk_QOpenGLPaintDevice_PropertyStrings);
    SbkPySide6_QtOpenGLTypes[SBK_QOPENGLPAINTDEVICE_IDX]
        = Sbk_QOpenGLPaintDevice_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QOpenGLPaintDevice_TypeF(),
        QOpenGLPaintDevice_PythonToCpp_QOpenGLPaintDevice_PTR,
        is_QOpenGLPaintDevice_PythonToCpp_QOpenGLPaintDevice_PTR_Convertible,
        QOpenGLPaintDevice_PTR_CppToPython_QOpenGLPaintDevice);

    Shiboken::Conversions::registerConverterName(converter, "QOpenGLPaintDevice");
    Shiboken::Conversions::registerConverterName(converter, "QOpenGLPaintDevice*");
    Shiboken::Conversions::registerConverterName(converter, "QOpenGLPaintDevice&");
    Shiboken::Conversions::registerConverterName(converter, typeid(::QOpenGLPaintDevice).name());
    Shiboken::Conversions::registerConverterName(converter, typeid(::QOpenGLPaintDeviceWrapper).name());


    Shiboken::ObjectType::setTypeDiscoveryFunctionV2(Sbk_QOpenGLPaintDevice_TypeF(), &Sbk_QOpenGLPaintDevice_typeDiscovery);

}
