You can use properties for that. If you construct a map that tells you what property to use for given type of a widget (for example"text" for QLineEdit), you can check the type using QMetaObject::className() or QObject::inherits() and then use QObject::setProperty(). For lookup you can use QObject::findChildren() and QObject::objectName.

Also take a look at QDataWidgetMapper.