diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-02 10:52:18 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-30 08:21:03 +0000 |
commit | 0f922f604297a2022527f04a696da121396ddc0a (patch) | |
tree | 5a40599046ff6ab940aff6d639530237ce08c4d8 /sources/shiboken2/tests/libsample/virtualmethods.cpp | |
parent | 7af97fa4136d66bbad6c7907de6e7bd823de2e43 (diff) |
Add QStringView/QByteArrayView
View types as function parameters cannot be converted in the standard
way shiboken does it:
QStringView cppArg0;
pythonToCpp(pyArg, &cppArg0);
since they reference some other data.
Introduce a new "viewOn" member to type system entry for them. It
causes the function arguments to be replaced by their viewed-on types
(stringview->string) via metatype.
Add a test in libsample and a test for QUuid::fromString(QStringView).
Test returning QStringView via QRegularExpressionMatch::capturedView().
Task-number: QTBUG-84319
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Task-number: PYSIDE-487
Change-Id: Iddb4ea268a54928d290e29012e2738772fae83f0
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/tests/libsample/virtualmethods.cpp')
-rw-r--r-- | sources/shiboken2/tests/libsample/virtualmethods.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/shiboken2/tests/libsample/virtualmethods.cpp b/sources/shiboken2/tests/libsample/virtualmethods.cpp index 8f9c8f64d..705835c0b 100644 --- a/sources/shiboken2/tests/libsample/virtualmethods.cpp +++ b/sources/shiboken2/tests/libsample/virtualmethods.cpp @@ -63,6 +63,11 @@ const Str & VirtualMethods::returnConstRef() const return result; } +int VirtualMethods::stringViewLength(std::string_view in) const +{ + return int(in.size()); +} + double VirtualDaughter2::virtualMethod0(Point pt, int val, Complex cpx, bool b) { return 42 + VirtualMethods::virtualMethod0(pt, val, cpx, b); |