aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysideqenum.h
blob: 82e22e77353f874f014686813a3b429eb5218f23 (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef PYSIDE_QENUM_H
#define PYSIDE_QENUM_H

#include <sbkpython.h>

#include <pysidemacros.h>

#include <vector>

#include <QtCore/qbytearray.h>

QT_FORWARD_DECLARE_CLASS(QMetaType)

namespace PySide::QEnum {

// PYSIDE-957: Support the QEnum macro
PYSIDE_API PyObject *QEnumMacro(PyObject *, bool);
PYSIDE_API int isFlag(PyObject *);
PYSIDE_API std::vector<PyObject *> resolveDelayedQEnums(PyTypeObject *);
PYSIDE_API void init();


// PYSIDE-2840: For an enum registered in Qt, return the C++ name.
// Ignore flags here; their underlying enums are of Python type flags anyways.
PYSIDE_API QByteArray getTypeName(PyTypeObject *type);

// Create a QMetaType for a decorated Python enum (int), enabling
// modification of properties by Qt Widgets Designer.
QMetaType createGenericEnumMetaType(const QByteArray &name, PyTypeObject *pyType);

// Like createGenericEnumMetaType(), but for "unsigned long long".
QMetaType createGenericEnum64MetaType(const QByteArray &name, PyTypeObject *pyType);

} // namespace PySide::QEnum

#endif