[Development] ODP: Qt 5.2 header diff: QtCore
Nowacki Jedrzej
Jedrzej.Nowacki at digia.com
Tue Nov 5 11:51:54 CET 2013
On segunda-feira, 4 de novembro de 2013 16:07:32, Thiago Macieira wrote:
> I didn't find anything, but I did not review qmetatype.h.
I looked into qmetatype.h. There is a lot of new symbols most of them hidden in a private namspace. None symbol was removed. I believe BC is fine.
I see one potential bug here:
+#ifndef QT_NO_DEBUG_STREAM
+ template<typename T>
+ static bool registerDebugStreamOperator()
+ {
+ Q_STATIC_ASSERT_X((!QMetaTypeId2<T>::IsBuiltIn),
+ "QMetaType::registerDebugStreamOperator: The type must be a custom type.");
+
+ const int typeId = qMetaTypeId<T>();
+ static const QtPrivate::BuiltInDebugStreamFunction<T> f;
+ return registerDebugStreamOperatorFunction(&f, typeId);
+ }
+ template<typename T>
+ static bool hasRegisteredDebugStreamOperator()
+ {
+ return hasRegisteredDebugStreamOperator(qMetaTypeId<T>());
+ }
+ static bool hasRegisteredDebugStreamOperator(int typeId);
+#endif
It changes the public interface depending on QT_NO_DEBUG_STREAM which is suboptimal especially that even if the flag is specified QDebug is defined. The same happens here:
+#ifndef QT_NO_DEBUG_STREAM
+ template<typename T>
+ static bool registerDebugStreamOperator()
+ {
+ Q_STATIC_ASSERT_X((!QMetaTypeId2<T>::IsBuiltIn),
+ "QMetaType::registerDebugStreamOperator: The type must be a custom type.");
+
+ const int typeId = qMetaTypeId<T>();
+ static const QtPrivate::BuiltInDebugStreamFunction<T> f;
+ return registerDebugStreamOperatorFunction(&f, typeId);
+ }
+ template<typename T>
+ static bool hasRegisteredDebugStreamOperator()
+ {
+ return hasRegisteredDebugStreamOperator(qMetaTypeId<T>());
+ }
+ static bool hasRegisteredDebugStreamOperator(int typeId);
+#endif
I have found also an inconsistency in the naming:
+ static bool registerComparators()
...
+ template<typename T>
+ static bool hasRegisteredComparators()
...
+ static bool hasRegisteredComparators(int typeId);
but
+ static bool registerDebugStreamOperator()
...
+ template<typename T>
+ static bool hasRegisteredDebugStreamOperator()
...
+ static bool hasRegisteredDebugStreamOperator(int typeId);
and
+ static bool registerConverter(MemberFunction function);
+ static bool registerConverter(MemberFunctionOk function);
+ static bool registerConverter(UnaryFunction function);
I suppose that we should not use plural form registerComparators.
Cheers,
Jędrek
More information about the Development
mailing list