aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/ApiExtractor/typesystem_enums.h2
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp4
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp5
3 files changed, 8 insertions, 3 deletions
diff --git a/sources/shiboken6/ApiExtractor/typesystem_enums.h b/sources/shiboken6/ApiExtractor/typesystem_enums.h
index fba411c2c..0148d1eba 100644
--- a/sources/shiboken6/ApiExtractor/typesystem_enums.h
+++ b/sources/shiboken6/ApiExtractor/typesystem_enums.h
@@ -109,7 +109,9 @@ enum class CPythonType
enum class PythonEnumType {
Unspecified,
+ Enum,
IntEnum,
+ Flag,
IntFlag
};
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index ae929d035..33d40432f 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -261,8 +261,10 @@ ENUM_LOOKUP_LINEAR_SEARCH()
ENUM_LOOKUP_BEGIN(TypeSystem::PythonEnumType, Qt::CaseSensitive,
pythonEnumTypeFromAttribute)
{
+ {u"Enum", TypeSystem::PythonEnumType::Enum},
{u"IntEnum", TypeSystem::PythonEnumType::IntEnum},
- {u"IntFlag", TypeSystem::PythonEnumType::IntFlag}
+ {u"Flag", TypeSystem::PythonEnumType::Flag},
+ {u"IntFlag", TypeSystem::PythonEnumType::IntFlag},
};
ENUM_LOOKUP_LINEAR_SEARCH()
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index ae6d83dd5..b165b6076 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -447,7 +447,7 @@ static QSet<QString> useIntSet()
/* IntEnum */ u"PySide6.QtQuick.QSGGeometry.DrawingMode"_s,
// Added because it should really be used as number
/* IntEnum */ u"PySide6.QtCore.QMetaType.Type"_s,
- /* IntEnum */ u"PySide6.QtSerialPort.QSerialPort.BaudRate"_s
+ /* IntEnum */ u"PySide6.QtSerialPort.QSerialPort.BaudRate"_s,
};
return result;
}
@@ -472,7 +472,8 @@ static QString BuildEnumFlagInfo(const AbstractMetaEnum &cppEnum)
bool _flag = bool(flags);
if (decision != TypeSystem::PythonEnumType::Unspecified) {
- _int = true;
+ _int = decision == TypeSystem::PythonEnumType::IntEnum ||
+ decision == TypeSystem::PythonEnumType::IntFlag;
if (!flags && decision == TypeSystem::PythonEnumType::IntFlag) {
qWarning() << "\nnote: " << enumType->name() << "is set as IntFlag without flags\n";
_flag = true;