Refactor QVariant handlers.
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>
Tue, 29 Nov 2011 14:42:33 +0000 (15:42 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 4 Jan 2012 13:25:25 +0000 (14:25 +0100)
commit08863b6fdaa8383e2274826db3ec42c4d4f11576
treea3cc772ada845bffa60f5b186defeb469bf1f5af
parent52fc6694b87e93fe0828424bb26d9279785de3e7
Refactor QVariant handlers.

QVariant implementation is based on delegation to a handler. The handler
has rather simple construction, it is a set of function that implements
a switch statement over known types and redirects calls to a right
method of an encapsulated types instance. Unfortunately after qt
modularization project, it is not easy to use types directly from
different modules, as they can be undefined or completely unaccessible.
Which means that each module has to implement own handler to cooperate
correctly with QVariant. We can suspect that list of modules known to
QVariant will grow and it is not limited to GUI, Widgets and Core,
therefore it would be nice to have an unified, from performance and
source code point of view, way of working with handlers.

This patch is an attempt to cleanup handlers. Keynotes:
- Each handler is working only on types defined in the same module
- Core handler implements handling of primitive types too
- Custom types have an own handler
- Each handler is independent which means that dispatch between handlers
  is done on QVariant level
- Handlers might be registered / unregistered using same interface

Change-Id: Ib096df65e2c4ce464bc7a684aade5af7d1264c24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/kernel/qmetatype_p.h
src/corelib/kernel/qvariant.cpp
src/corelib/kernel/qvariant.h
src/corelib/kernel/qvariant_p.h
src/gui/kernel/qguivariant.cpp
src/widgets/kernel/qwidgetsvariant.cpp
tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp