Re-factor code that do lazy property registration into a function.

The code was repeated in a different form 3 times.

Change-Id: I6d0deb5dd9a317e1aab6a97d5eb2fd647f597661
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Fix QMetaProperty::write so it tries to register a property type.

We can not assume that the property type is always registered, because
QVariant argument may contain an instance of a different type.

Change-Id: I4fc9593b826e13c401dbdacec4d60db36edc7102
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Fix maximal literal string limitation in moc.

C++ standard advise to place 64k char limit for string literals, this
patch improves moc output so it is not affected anymore.

Task-number: QTBUG-36500
Change-Id: Iece630faaef45baebe8c7afe4fc51e0362c713de
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Fix memory leaks in tst_moc

Change-Id: Id17c4253e7e7a2e4ab7fd9b290481ca90914b782
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>