aboutsummaryrefslogtreecommitdiff
path: root/libs/plugin_python/src/pybind11-qt/include/pybind11_qt/pybind11_qt_basic.h
blob: 911de342658a61796decd6a74cdd1ba2c17804f1 (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
#ifndef PYTHON_PYBIND11_QT_BASIC_HPP
#define PYTHON_PYBIND11_QT_BASIC_HPP

#include <QString>
#include <QVariant>

#include <pybind11/pybind11.h>

namespace pybind11::detail {

    // QString
    //
    template <>
    struct type_caster<QString> {
        PYBIND11_TYPE_CASTER(QString, const_name("str"));

        bool load(handle src, bool);

        static handle cast(QString src, return_value_policy policy, handle parent);
    };

    // QVariant - this needs to be defined BEFORE QVariantList
    //
    template <>
    struct type_caster<QVariant> {
    public:
        PYBIND11_TYPE_CASTER(QVariant, const_name("MoVariant"));

        bool load(handle src, bool);

        static handle cast(QVariant var, return_value_policy policy, handle parent);
    };

}  // namespace pybind11::detail

#endif