Specifically:
qputenv. What about qmake and the .pro file? What about Qt Creator build settings? What about commands like QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);? Are there other ways too? Please include any restrictions (e.g. qputenv must be used before instantiating the QApplication within main.cpp)There's a lot of confusion here... qmake and pro files can set environment variables for the compilation process, qputenv for the application itself (and its children).
setAttribute isn't even about environment variables - it's about some particular settings of the QGuiApplication.
Given that they affect completely different things, there's no way to talk about pros and cons - we are comparing apples to oranges.
As for setting environment variables to particular types, that's a question without much meaning - environment variables are just a dictionary of strings. If you want to set it to an integer, you'll have to convert it to a string first with whatever Qt/C/C++ method you prefer. As for the setAttribute, again it's a completely different thing, it just manipulates flags, so talking about setting a string or an integer has no meaning here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With