Add general optimizations in QtModeling and QtModelingWidgets

Change-Id: I059ec9f6e8ef5015849bd91d75181912b3a42ce6
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>