[sip] Implement MappedType for unique_ptr to Python conversion

This commit is contained in:
Nyall Dawson 2024-11-20 14:59:14 +10:00
parent f4c1c56a1a
commit 596ecbee9c
2 changed files with 37 additions and 0 deletions

View File

@ -1242,6 +1242,24 @@ which are not wrapped by PyQt:
%End
};
template <TYPE>
%MappedType std::unique_ptr< TYPE > /NoRelease,AllowNone,TypeHint="Optional[TYPE]",TypeHintValue="TYPE"/
{
%TypeHeaderCode
#include <memory>
%End
%ConvertFromTypeCode
const sipTypeDef *sip_type = sipFindType("TYPE*");
return sipConvertFromNewType(sipCpp->release(), sip_type, NULL);
%End
%ConvertToTypeCode
// only one way for now...
return 0;
%End
};
template <TYPE>
%MappedType QVector< QVector<TYPE> >
{

View File

@ -1241,6 +1241,25 @@ which are not wrapped by PyQt:
%End
};
template <TYPE>
%MappedType std::unique_ptr< TYPE > /NoRelease,AllowNone,TypeHint="Optional[TYPE]",TypeHintValue="TYPE"/
{
%TypeHeaderCode
#include <memory>
%End
%ConvertFromTypeCode
const sipTypeDef *sip_type = sipFindType("TYPE*");
return sipConvertFromNewType(sipCpp->release(), sip_type, NULL);
%End
%ConvertToTypeCode
// only one way for now...
return 0;
%End
};
template <TYPE>
%MappedType QVector< QVector<TYPE> >
{