aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtGui/glue/wid_conversions.h
blob: 68d752884d4c174397190aa977e81751a5aed176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef Q_WS_WIN

namespace Shiboken {
template <>
struct Converter<WId>
{
    static bool checkType(PyObject* pyObj)
    {
        return false;
    }

    static bool isConvertible(PyObject* pyobj)
    {
        return pyobj == Py_None || PyNumber_Check(pyobj);
    }

    static inline PyObject* toPython(void* cppobj)
    {
        // not supported
        Q_ASSERT(true);
        return 0;
    }

    static PyObject* toPython(WId cppobj)
    {
        return PyLong_FromVoidPtr((void*)cppobj);
    }

    static WId toCpp(PyObject* pyobj)
    {
        if (pyobj == Py_None)
            return 0;
        return (WId)PyLong_AsVoidPtr(pyobj);
    }
};

}

#endif