UPDATE:
Maybe using QQmlAbstractUrlInterceptor is a good idea to automatically import platform specified component which does not require to modify the Qt source. For example:
class QmlImportUrlInterceptor : public QQmlAbstractUrlInterceptor {
public:
virtual QUrl intercept(const QUrl &url, DataType type) override
{
if (type != UrlString && !url.isEmpty() && url.isValid()) {
QString str = url.toString(QUrl::None);
#if defined(Q_OS_WIN64)
return str.replace(QStringLiteral("$(PLATFORM)"), QStringLiteral("win64"));
#else
return str.replace(QStringLiteral("$(PLATFORM)"), QStringLiteral("win32"));
#endif // WIN64 || _WIN64
}
return url;
}
};
Usage in qml files:
import "$(PLATFORM)_impl" as Impl
Impl.NativeComponent {
}
However, there's a bug with QQmlImport, so that intercepting qml local file will never work :( see QTBUG-73843