diff options
Diffstat (limited to 'src/corelib/kernel/qjniobject.h')
-rw-r--r-- | src/corelib/kernel/qjniobject.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/kernel/qjniobject.h b/src/corelib/kernel/qjniobject.h index 589f6489f7..af6c54e5aa 100644 --- a/src/corelib/kernel/qjniobject.h +++ b/src/corelib/kernel/qjniobject.h @@ -670,7 +670,7 @@ inline bool operator!=(const QJniObject &obj1, const QJniObject &obj2) } namespace QtJniTypes { -struct JObjectBase +struct QT_TECH_PREVIEW_API JObjectBase { operator QJniObject() const { return m_object; } @@ -685,6 +685,10 @@ struct JObjectBase protected: JObjectBase() = default; + JObjectBase(const JObjectBase &) = default; + JObjectBase(JObjectBase &&) = default; + JObjectBase &operator=(const JObjectBase &) = default; + JObjectBase &operator=(JObjectBase &&) = default; ~JObjectBase() = default; Q_IMPLICIT JObjectBase(jobject object) : m_object(object) {} @@ -695,7 +699,7 @@ protected: }; template<typename Type> -class JObject : public JObjectBase +class QT_TECH_PREVIEW_API JObject : public JObjectBase { public: using Class = Type; @@ -707,7 +711,7 @@ public: Q_IMPLICIT JObject(const QJniObject &object) : JObjectBase(object) {} Q_IMPLICIT JObject(QJniObject &&object) noexcept : JObjectBase(std::move(object)) {} - // base class destructor is protected, so need to provide all SMFs + // base class SMFs are protected, make them public: JObject(const JObject &other) = default; JObject(JObject &&other) noexcept = default; JObject &operator=(const JObject &other) = default; @@ -822,7 +826,7 @@ auto QJniObject::LocalFrame<Args...>::convertToJni(T &&value) return newLocalRef<jstring>(QJniObject::fromString(value)); } else if constexpr (QtJniTypes::IsJniArray<Type>::value) { return value.arrayObject(); - } else if constexpr (QJniArrayBase::canConvert<T>) { + } else if constexpr (QJniArrayBase::isContiguousContainer<T>) { using QJniArrayType = decltype(QJniArrayBase::fromContainer(std::forward<T>(value))); using ArrayType = decltype(std::declval<QJniArrayType>().arrayObject()); return newLocalRef<ArrayType>(QJniArrayBase::fromContainer(std::forward<T>(value)).template object<jobject>()); @@ -843,7 +847,7 @@ auto QJniObject::LocalFrame<Args...>::convertFromJni(QJniObject &&object) return object.toString(); } else if constexpr (QtJniTypes::IsJniArray<Type>::value) { return T(std::move(object)); - } else if constexpr (QJniArrayBase::canConvert<Type>) { + } else if constexpr (QJniArrayBase::isContiguousContainer<Type>) { // if we were to create a QJniArray from Type... using QJniArrayType = decltype(QJniArrayBase::fromContainer(std::declval<Type>())); // then that QJniArray would have elements of type |