Format independency 16:9 and 4:3
I am developing a UI which will be used on various devices. The new ones have a 16:9 aspect ratio, the older ones - 4:3. Do I have to make two UI versions or is there a simpler way to achieve this independency?
It depends on what kind of UI you are developing. For dialog-like UI, a good layout should take care of different aspect ratios - but make sure you test your application for all targeted resolutions, anyway.
So it is not possible to achieve this through some code line, which recognizes what kind of device it is and adjusts the sizes of the elements accordingly to the format?
That heavily depends on your layout, like Asperamanca already said.
Also what technology you are using, with QtQuick (QML) you can use layout anchors and that will essentially scale your layout to the window size if you want to, with a classic widget that is no so easily done I think.
maybe a screenshot or idea of your app layout would be helpful here?
Of course there is no magic way to just scale everything to all window/screen sizes.. :D