On Thursday 02 July 2015 23:00:43 Bernhard wrote: > Unfortunately adding signals of the template’s type is exactly what I would > have needed several times. In that case there is no clean solution. I once > added QVariant based signals as a workaround but that was ridiculous. In > modern times having powerful C++ generic programming features it is a shame > that QObject doesn’t support this. IMHO this is one of the features (like > C++11) that need to be introduced in Qt as fast as possible if it should > not appear old-fashioned soon.
The problem in doing this is how to create the meta object so that runtime reflection works. Using the template parameter(s) inside the class leads to HUGE complexity. Think of something horribly complex: you're probably only two orders of magnitude away from the real complexity. One way of doing this would be to drop the meta object and the runtime reflection. That would also get rid of QtScript, QtQml, QtDBus, ActiveQt, QtWebKit's registering of QObjects, etc. It's a complete non-starter. Another way is to do it like CopperSpice is doing, by way of boilerplate macros and manual runtime registration, at the expense of making the code (subjectively) harder to read and of runtime cost. Qt's current[1] meta object system is *entirely* read-only, shared memory, except for the QMetaObject structure itself, which is read-only data with local relocations[2]. This is much beyond pure C++: we're investigating performance, code size, data size, relocation count, etc. [1] Current, because it wasn't so before Qt 4. So you see that this has 15 years of learnings applied. [2] Local relocations, as opposed to global relocations, are much faster to resolve, as they have no symbol name to be looked up. Also, local relocations disappear on position-dependent code, which we'll get back to allowing once GCC introduces the necessary options. PS: I've just got an idea for getting rid of the relocations on Linux/x86-64... I need to check if there's a way of doing it before Qt 6. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development