
// Workaround to access protected functions
#ifndef protected
#  define protected public
#endif

// default includes
#include <shiboken.h>
#include <sbkpep.h>
#include <sbkpepbuffer.h>

#define PYSIDE6_COMOPT_COMPRESS 1

#ifndef QT_NO_VERSION_TAGGING
#  define QT_NO_VERSION_TAGGING
#endif
#include <QtCore/QDebug>
#include <pysideqenum.h>
#include <pysideutils.h>
#include <feature_select.h>
QT_WARNING_DISABLE_DEPRECATED


// module include
#include "kwidgetsaddons_python.h"

// main header
#include "kstyleextensions_wrapper.h"

// Argument includes
#include <QString>
#include <qstyle.h>
#include <qwidget.h>

#include <cctype>
#include <cstring>
#include <iterator>
#include <type_traits>
#include <typeinfo>


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

extern "C" {
static int Sbk_KStyleExtensions_Init(PyObject *, PyObject *, PyObject *)
{
    Shiboken::Errors::setInstantiateNamespace("KStyleExtensions");
    return -1;
}

static PyObject *Sbk_KStyleExtensionsFunc_customControlElement([[maybe_unused]] PyObject *self, PyObject *args)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "customControlElement", 2, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static KStyleExtensions::customControlElement(const QString&,const QWidget*)->QStyle::ControlElement
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QWidget_IDX]), (pyArgs[1])))) {
        overloadId = 0; // static KStyleExtensions::customControlElement(const QString&,const QWidget*)->QStyle::ControlElement
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "customControlElement", SbkKWidgetsAddonsTypeStructs[SBK_KWidgetsAddonsKStyleExtensions_IDX]);

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QWidget *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static KStyleExtensions::customControlElement(const QString&,const QWidget*)->QStyle::ControlElement
            QStyle::ControlElement cppResult = ::KStyleExtensions::customControlElement(cppArg0, cppArg1);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Enum::getConverter(reinterpret_cast<SbkEnumType *>(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QStyle_ControlElement_IDX]))), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KStyleExtensionsFunc_customStyleHint([[maybe_unused]] PyObject *self, PyObject *args)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "customStyleHint", 2, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static KStyleExtensions::customStyleHint(const QString&,const QWidget*)->QStyle::StyleHint
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QWidget_IDX]), (pyArgs[1])))) {
        overloadId = 0; // static KStyleExtensions::customStyleHint(const QString&,const QWidget*)->QStyle::StyleHint
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "customStyleHint", SbkKWidgetsAddonsTypeStructs[SBK_KWidgetsAddonsKStyleExtensions_IDX]);

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QWidget *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static KStyleExtensions::customStyleHint(const QString&,const QWidget*)->QStyle::StyleHint
            QStyle::StyleHint cppResult = ::KStyleExtensions::customStyleHint(cppArg0, cppArg1);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Enum::getConverter(reinterpret_cast<SbkEnumType *>(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QStyle_StyleHint_IDX]))), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}

static PyObject *Sbk_KStyleExtensionsFunc_customSubElement([[maybe_unused]] PyObject *self, PyObject *args)
{
    PyObject *pyResult{};
    Shiboken::AutoDecRef errInfo{};
    Shiboken::PythonContextMarker pcm;
    int overloadId = -1;
    [[maybe_unused]] Shiboken::Conversions::PythonToCppConversion pythonToCpp[2];
    const Py_ssize_t numArgs = PyTuple_Size(args);
    SBK_UNUSED(numArgs)
    PyObject *pyArgs[] = {nullptr, nullptr};

    // invalid argument lengths

    if (PyArg_UnpackTuple(args, "customSubElement", 2, 2, &(pyArgs[0]), &(pyArgs[1])) == 0)
        return {};


    // Overloaded function decisor
    // 0: static KStyleExtensions::customSubElement(const QString&,const QWidget*)->QStyle::SubElement
    if (numArgs == 2
        && (pythonToCpp[0] = Shiboken::Conversions::pythonToCppConversion(SbkPySide6_QtCoreTypeConverters[SBK_QString_IDX], (pyArgs[0])))
        && (pythonToCpp[1] = Shiboken::Conversions::pythonToCppPointerConversion(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QWidget_IDX]), (pyArgs[1])))) {
        overloadId = 0; // static KStyleExtensions::customSubElement(const QString&,const QWidget*)->QStyle::SubElement
    }

    // Function signature not found.
    if (overloadId == -1)
        return Shiboken::returnWrongArguments(args, "customSubElement", SbkKWidgetsAddonsTypeStructs[SBK_KWidgetsAddonsKStyleExtensions_IDX]);

    // Call function/method
    {
        ::QString cppArg0;
        pythonToCpp[0](pyArgs[0], &cppArg0);
        if (!Shiboken::Object::isValid(pyArgs[1]))
            return {};
        ::QWidget *cppArg1;
        pythonToCpp[1](pyArgs[1], &cppArg1);

        if (Shiboken::Errors::occurred() == nullptr) {
            // static KStyleExtensions::customSubElement(const QString&,const QWidget*)->QStyle::SubElement
            QStyle::SubElement cppResult = ::KStyleExtensions::customSubElement(cppArg0, cppArg1);
            pyResult = Shiboken::Conversions::copyToPython(Shiboken::Enum::getConverter(reinterpret_cast<SbkEnumType *>(Shiboken::Module::get(SbkPySide6_QtWidgetsTypeStructs[SBK_QStyle_SubElement_IDX]))), &cppResult);
        }
    }

    return Sbk_ReturnFromPython_Result(pyResult);
}


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

static PyMethodDef Sbk_KStyleExtensions_methods[] = {
    {"customControlElement", reinterpret_cast<PyCFunction>(Sbk_KStyleExtensionsFunc_customControlElement), METH_VARARGS|METH_STATIC, nullptr},
    {"customStyleHint", reinterpret_cast<PyCFunction>(Sbk_KStyleExtensionsFunc_customStyleHint), METH_VARARGS|METH_STATIC, nullptr},
    {"customSubElement", reinterpret_cast<PyCFunction>(Sbk_KStyleExtensionsFunc_customSubElement), METH_VARARGS|METH_STATIC, nullptr},
    {nullptr, nullptr, 0, nullptr} // Sentinel
};

} // extern "C"

static int Sbk_KStyleExtensions_traverse(PyObject *self, visitproc visit, void *arg)
{
    auto traverseProc = reinterpret_cast<traverseproc>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_traverse));
    ;
    return traverseProc(self, visit, arg);
}
static int Sbk_KStyleExtensions_clear(PyObject *self)
{
    auto clearProc = reinterpret_cast<inquiry>(PyType_GetSlot(SbkObject_TypeF(), Py_tp_clear));
    ;
    return clearProc(self);
}

// Class Definition -----------------------------------------------
extern "C" {

static PyType_Slot Sbk_KStyleExtensions_slots[] = {
    {Py_tp_base,        nullptr}, // inserted by introduceWrapperType
    {Py_tp_dealloc,     reinterpret_cast<void *>(Sbk_object_dealloc /* PYSIDE-832: Prevent replacement of "0" with subtype_dealloc. */)},
    {Py_tp_traverse,    reinterpret_cast<void *>(Sbk_KStyleExtensions_traverse)},
    {Py_tp_clear,       reinterpret_cast<void *>(Sbk_KStyleExtensions_clear)},
    {Py_tp_methods,     reinterpret_cast<void *>(Sbk_KStyleExtensions_methods)},
    {Py_tp_init,        reinterpret_cast<void *>(Sbk_KStyleExtensions_Init)},
    {Py_tp_new,         reinterpret_cast<void *>(SbkDummyNew /* PYSIDE-595: Prevent replacement of "0" with base->tp_new. */)},
    {0, nullptr}
};
static PyType_Spec Sbk_KStyleExtensions_spec = {
    "1:KWidgetsAddons.KStyleExtensions",
    sizeof(SbkObject),
    0,
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
    Sbk_KStyleExtensions_slots
};

} //extern "C"

// Type conversion functions.

// The signatures string for the functions.
// Multiple signatures have their index "n:" in front.
#if PYSIDE6_COMOPT_COMPRESS == 0
static const char *KWidgetsAddonsKStyleExtensions_SignatureStrings[] = {
    "KWidgetsAddons.KStyleExtensions.customControlElement(element:QString,widget:PySide6.QtWidgets.QWidget)->PySide6.QtWidgets.QStyle.ControlElement",
    "KWidgetsAddons.KStyleExtensions.customStyleHint(element:QString,widget:PySide6.QtWidgets.QWidget)->PySide6.QtWidgets.QStyle.StyleHint",
    "KWidgetsAddons.KStyleExtensions.customSubElement(element:QString,widget:PySide6.QtWidgets.QWidget)->PySide6.QtWidgets.QStyle.SubElement",
    nullptr}; // Sentinel
#else
static constexpr size_t KWidgetsAddonsKStyleExtensions_SignatureByteSize = 125;
static constexpr uint8_t KWidgetsAddonsKStyleExtensions_SignatureBytes[125] = {
    0x78, 0xda, 0xf3, 0x0e, 0xcf, 0x4c, 0x49, 0x4f, 0x2d, 0x29, 0x76, 0x4c, 0x49, 0xc9, 0xcf, 0x2b,
    0xd6, 0xf3, 0x0e, 0x2e, 0xa9, 0xcc, 0x49, 0x75, 0xad, 0x28, 0x49, 0xcd, 0x2b, 0xce, 0x04, 0x09,
    0x24, 0x97, 0x16, 0x97, 0xe4, 0xe7, 0x3a, 0xe7, 0xe7, 0x95, 0x14, 0xe5, 0xe7, 0xb8, 0xe6, 0xa4,
    0xe6, 0xa6, 0xe6, 0x95, 0x68, 0xa4, 0x42, 0x68, 0xab, 0xc0, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74,
    0x9d, 0x72, 0xb0, 0x19, 0x56, 0x01, 0x95, 0xc1, 0x99, 0x29, 0xa9, 0x66, 0x7a, 0x81, 0x25, 0x50,
    0x43, 0xf5, 0x02, 0x21, 0x0c, 0x4d, 0x5d, 0x3b, 0x2c, 0x72, 0x60, 0xab, 0xf4, 0x50, 0x8d, 0xe6,
    0xf2, 0x26, 0xca, 0x3d, 0x60, 0x51, 0x8f, 0x4c, 0x2a, 0x3b, 0x05, 0x6e, 0x2a, 0xb1, 0xae, 0x28,
    0x4d, 0xa2, 0x45, 0x88, 0x20, 0x8c, 0xe5, 0x02, 0x00, 0xc6, 0xae, 0x9b, 0x0c
};
#endif

PyTypeObject *init_KWidgetsAddonsKStyleExtensions(PyObject *module)
{
    auto &typeStruct = SbkKWidgetsAddonsTypeStructs[SBK_KWidgetsAddonsKStyleExtensions_IDX];
    if (typeStruct.type != nullptr)
        return typeStruct.type;

    auto *base1 = SbkObject_TypeF();
    Shiboken::AutoDecRef Sbk_KStyleExtensions_Type_bases(PyTuple_Pack(1, base1));

    PyTypeObject *pyType = Shiboken::ObjectType::introduceWrapperType(
        module,
        "KStyleExtensions",
        "KStyleExtensions",
        &Sbk_KStyleExtensions_spec,
        nullptr,
        Sbk_KStyleExtensions_Type_bases.object(),
        0);
#if PYSIDE6_COMOPT_COMPRESS == 0
    InitSignatureStrings(pyType, KWidgetsAddonsKStyleExtensions_SignatureStrings);
#else
    InitSignatureBytes(pyType, KWidgetsAddonsKStyleExtensions_SignatureBytes, KWidgetsAddonsKStyleExtensions_SignatureByteSize);
#endif
    SbkObjectType_SetPropertyStrings(pyType, Sbk_KStyleExtensions_PropertyStrings);
    typeStruct.type = pyType;



    return pyType;
}
