/****************************************************************************
**
** 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_qtgui_python.h"

// main header
#include "qtextdocumentfragment_wrapper.h"

// inner classes

// Extra includes
#include <QtGui/qtextcursor.h>
#include <QtGui/qtextdocument.h>
#include <QtGui/qtextdocumentfragment.h>


#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;
}


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

extern "C" {
static int
Sbk_QTextDocumentFragment_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< ::QTextDocumentFragment >()))
        return -1;

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

    // invalid argument lengths


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


    // Overloaded function decisor
    // 0: QTextDocumentFragment::QTextDocumentFragment()
    // 1: QTextDocumentFragment::QTextDocumentFragment(QTextCursor)
    // 2: QTextDocumentFragment::QTextDocumentFragment(const QTextDocument*)
    // 3: QTextDocumentFragment::QTextDocumentFragment(QTextDocumentFragment)
    if (numArgs == 0) {
        overloadId = 0; // QTextDocumentFragment()
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], (pyArgs[0])))) {
        overloadId = 3; // QTextDocumentFragment(QTextDocumentFragment)
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENT_IDX], (pyArgs[0])))) {
        overloadId = 2; // QTextDocumentFragment(const QTextDocument*)
    } else if (numArgs == 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppReferenceConversion(SbkPySide6_QtGuiTypes[SBK_QTEXTCURSOR_IDX], (pyArgs[0])))) {
        overloadId = 1; // QTextDocumentFragment(QTextCursor)
    }

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

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

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


            if (!PyErr_Occurred()) {
                // QTextDocumentFragment(QTextCursor)
                cptr = new ::QTextDocumentFragment(*cppArg0);
            }
            break;
        }
        case 2: // QTextDocumentFragment(const QTextDocument * document)
        {
            if (!Shiboken::Object::isValid(pyArgs[0]))
                return -1;
            ::QTextDocument *cppArg0;
            pythonToCpp[0](pyArgs[0], &cppArg0);

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


            if (!PyErr_Occurred()) {
                // QTextDocumentFragment(QTextDocumentFragment)
                cptr = new ::QTextDocumentFragment(*cppArg0);
            }
            break;
        }
    }

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

    Shiboken::Object::setValidCpp(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_QTextDocumentFragment_Init_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return -1;
}

static PyObject *Sbk_QTextDocumentFragmentFunc_fromHtml(PyObject *self, PyObject *args, PyObject *kwds)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtGui.QTextDocumentFragment.fromHtml";
    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 (numArgs > 2) {
        static PyObject *const too_many = Shiboken::String::createStaticString(">");
        errInfo.reset(too_many);
        Py_INCREF(errInfo.object());
        goto Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError;
    } else if (numArgs < 1) {
        static PyObject *const too_few = Shiboken::String::createStaticString("<");
        errInfo.reset(too_few);
        Py_INCREF(errInfo.object());
        goto Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError;
    }

    if (!PyArg_ParseTuple(args, "|OO:fromHtml", &(pyArgs[0]), &(pyArgs[1])))
        return {};


    // Overloaded function decisor
    // 0: static QTextDocumentFragment::fromHtml(QString,const QTextDocument*)->QTextDocumentFragment
    if (numArgs >= 1
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArgs[0])))) {
        if (numArgs == 1) {
            overloadId = 0; // fromHtml(QString,const QTextDocument*)
        } else if (numArgs >= 2
            && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENT_IDX], (pyArgs[1])))) {
            overloadId = 0; // fromHtml(QString,const QTextDocument*)
        }
    }

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

    // Call function/method
    {
        if (kwds && PyDict_Size(kwds) > 0) {
            PyObject *value{};
            Shiboken::AutoDecRef kwds_dup(PyDict_Copy(kwds));
            static PyObject *const key_resourceProvider = Shiboken::String::createStaticString("resourceProvider");
            if (PyDict_Contains(kwds, key_resourceProvider)) {
                value = PyDict_GetItem(kwds, key_resourceProvider);
                if (value && pyArgs[1]) {
                    errInfo.reset(key_resourceProvider);
                    Py_INCREF(errInfo.object());
                    goto Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError;
                }
                if (value) {
                    pyArgs[1] = value;
                    if (!(pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENT_IDX], (pyArgs[1]))))
                        goto Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError;
                }
                PyDict_DelItem(kwds_dup, key_resourceProvider);
            }
            if (PyDict_Size(kwds_dup) > 0) {
                errInfo.reset(kwds_dup.release());
                goto Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError;
            }
        }
        ::QString cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QTextDocument *cppArg1 = nullptr;
        if (pythonToCpp[1])
            pythonToCpp[1](pyArgs[1], &cppArg1);

        if (!PyErr_Occurred()) {
            // fromHtml(QString,const QTextDocument*)
            QTextDocumentFragment cppResult = ::QTextDocumentFragment::fromHtml(cppArg0, cppArg1);
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], &cppResult);
        }
    }

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

    Sbk_QTextDocumentFragmentFunc_fromHtml_TypeError:
        Shiboken::setErrorAboutWrongArguments(args, fullName, errInfo);
        return {};
}

static PyObject *Sbk_QTextDocumentFragmentFunc_fromPlainText(PyObject *self, PyObject *pyArg)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtGui.QTextDocumentFragment.fromPlainText";
    SBK_UNUSED(fullName)
    int overloadId = -1;
    Shiboken::Conversions::PythonToCppConversion pythonToCpp;
    SBK_UNUSED(pythonToCpp)

    // Overloaded function decisor
    // 0: static QTextDocumentFragment::fromPlainText(QString)->QTextDocumentFragment
    if ((pythonToCpp = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], (pyArg)))) {
        overloadId = 0; // fromPlainText(QString)
    }

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

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

        if (!PyErr_Occurred()) {
            // fromPlainText(QString)
            QTextDocumentFragment cppResult = ::QTextDocumentFragment::fromPlainText(cppArg0);
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], &cppResult);
        }
    }

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

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

static PyObject *Sbk_QTextDocumentFragmentFunc_isEmpty(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QTextDocumentFragment *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtGui.QTextDocumentFragment.isEmpty";
    SBK_UNUSED(fullName)

    // Call function/method
    {

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

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

static PyObject *Sbk_QTextDocumentFragmentFunc_toHtml(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QTextDocumentFragment *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtGui.QTextDocumentFragment.toHtml";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // toHtml()const
            QString cppResult = const_cast<const ::QTextDocumentFragment *>(cppSelf)->toHtml();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

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

static PyObject *Sbk_QTextDocumentFragmentFunc_toPlainText(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto cppSelf = reinterpret_cast< ::QTextDocumentFragment *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], reinterpret_cast<SbkObject *>(self)));
    SBK_UNUSED(cppSelf)
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    static const char *fullName = "PySide6.QtGui.QTextDocumentFragment.toPlainText";
    SBK_UNUSED(fullName)

    // Call function/method
    {

        if (!PyErr_Occurred()) {
            // toPlainText()const
            QString cppResult = const_cast<const ::QTextDocumentFragment *>(cppSelf)->toPlainText();
            pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtCoreTypeConverters[SBK_QSTRING_IDX], &cppResult);
        }
    }

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

static PyObject *Sbk_QTextDocumentFragment___copy__(PyObject *self)
{
    if (!Shiboken::Object::isValid(self))
        return {};
    auto &cppSelf = *reinterpret_cast< ::QTextDocumentFragment *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], reinterpret_cast<SbkObject *>(self)));
    PyObject *pyResult = Shiboken::Conversions::copyToPython(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], &cppSelf);
    if (PyErr_Occurred() || !pyResult) {
        Py_XDECREF(pyResult);
        return {};
    }
    return pyResult;
}


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

static PyMethodDef Sbk_QTextDocumentFragment_methods[] = {
    {"fromHtml", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragmentFunc_fromHtml), METH_VARARGS|METH_KEYWORDS|METH_STATIC},
    {"fromPlainText", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragmentFunc_fromPlainText), METH_O|METH_STATIC},
    {"isEmpty", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragmentFunc_isEmpty), METH_NOARGS},
    {"toHtml", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragmentFunc_toHtml), METH_NOARGS},
    {"toPlainText", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragmentFunc_toPlainText), METH_NOARGS},

    {"__copy__", reinterpret_cast<PyCFunction>(Sbk_QTextDocumentFragment___copy__), METH_NOARGS},
    {nullptr, nullptr} // Sentinel
};

} // extern "C"

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

static PyType_Slot Sbk_QTextDocumentFragment_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,    nullptr},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_QTextDocumentFragment_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_QTextDocumentFragment_clear)},
    {Py_tp_richcompare, nullptr},
    {Py_tp_iter,        nullptr},
    {Py_tp_iternext,    nullptr},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_QTextDocumentFragment_methods)},
    {Py_tp_getset,      nullptr},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_QTextDocumentFragment_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkObjectTpNew)},
    {0, nullptr}
};
static PyType_Spec Sbk_QTextDocumentFragment_spec = {
    "2:PySide6.QtGui.QTextDocumentFragment",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_QTextDocumentFragment_slots
};

} //extern "C"


// Type conversion functions.

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

// C++ to Python pointer conversion - tries to find the Python wrapper for the C++ object (keeps object identity).
static PyObject *QTextDocumentFragment_PTR_CppToPython_QTextDocumentFragment(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 ::QTextDocumentFragment *>(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_QTextDocumentFragment_TypeF(), const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);
    if (changedTypeName)
        delete [] typeName;
    return result;
}

// C++ to Python copy conversion.
static PyObject *QTextDocumentFragment_COPY_CppToPython_QTextDocumentFragment(const void *cppIn)
{
    return Shiboken::Object::newObject(Sbk_QTextDocumentFragment_TypeF(), new ::QTextDocumentFragment(*reinterpret_cast<const ::QTextDocumentFragment *>(cppIn)), true, true);
}

// Python to C++ copy conversion.
static void QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_COPY(PyObject *pyIn, void *cppOut)
{
    *reinterpret_cast<::QTextDocumentFragment *>(cppOut) = *reinterpret_cast< ::QTextDocumentFragment *>(Shiboken::Conversions::cppPointer(SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX], reinterpret_cast<SbkObject *>(pyIn)));
}
static PythonToCppFunc is_QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_COPY_Convertible(PyObject *pyIn)
{
    if (PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(Sbk_QTextDocumentFragment_TypeF())))
        return QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_COPY;
    return {};
}

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
static const char *QTextDocumentFragment_SignatureStrings[] = {
    "3:PySide6.QtGui.QTextDocumentFragment(self)",
    "2:PySide6.QtGui.QTextDocumentFragment(self,range:PySide6.QtGui.QTextCursor)",
    "1:PySide6.QtGui.QTextDocumentFragment(self,document:PySide6.QtGui.QTextDocument)",
    "0:PySide6.QtGui.QTextDocumentFragment(self,rhs:PySide6.QtGui.QTextDocumentFragment)",
    "PySide6.QtGui.QTextDocumentFragment.fromHtml(html:QString,resourceProvider:PySide6.QtGui.QTextDocument=nullptr)->PySide6.QtGui.QTextDocumentFragment",
    "PySide6.QtGui.QTextDocumentFragment.fromPlainText(plainText:QString)->PySide6.QtGui.QTextDocumentFragment",
    "PySide6.QtGui.QTextDocumentFragment.isEmpty(self)->bool",
    "PySide6.QtGui.QTextDocumentFragment.toHtml(self)->QString",
    "PySide6.QtGui.QTextDocumentFragment.toPlainText(self)->QString",
    "PySide6.QtGui.QTextDocumentFragment.__copy__()",
    nullptr}; // Sentinel

void init_QTextDocumentFragment(PyObject *module)
{
    _Sbk_QTextDocumentFragment_Type = Shiboken::ObjectType::introduceWrapperType(
        module,
        "QTextDocumentFragment",
        "QTextDocumentFragment",
        &Sbk_QTextDocumentFragment_spec,
        &Shiboken::callCppDestructor< ::QTextDocumentFragment >,
        0,
        0,
        0);
    auto *pyType = Sbk_QTextDocumentFragment_TypeF(); // references _Sbk_QTextDocumentFragment_Type
    InitSignatureStrings(pyType, QTextDocumentFragment_SignatureStrings);
    SbkObjectType_SetPropertyStrings(reinterpret_cast<PyTypeObject *>(_Sbk_QTextDocumentFragment_Type), Sbk_QTextDocumentFragment_PropertyStrings);
    SbkPySide6_QtGuiTypes[SBK_QTEXTDOCUMENTFRAGMENT_IDX]
        = Sbk_QTextDocumentFragment_TypeF();

    // Register Converter
    SbkConverter *converter = Shiboken::Conversions::createConverter(Sbk_QTextDocumentFragment_TypeF(),
        QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_PTR,
        is_QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_PTR_Convertible,
        QTextDocumentFragment_PTR_CppToPython_QTextDocumentFragment,
        QTextDocumentFragment_COPY_CppToPython_QTextDocumentFragment);

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

    // Add Python to C++ copy (value, not pointer neither reference) conversion to type converter.
    Shiboken::Conversions::addPythonToCppValueConversion(converter,
        QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_COPY,
        is_QTextDocumentFragment_PythonToCpp_QTextDocumentFragment_COPY_Convertible);

    qRegisterMetaType< ::QTextDocumentFragment >("QTextDocumentFragment");
}
