Paul Masri-Stone
Paul Masri-Stone

Reputation: 3139

In Qt, what are the different ways to set an environment variable and what are the pros & cons?

Specifically:

Upvotes: 4

Views: 6238

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126827

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.

Upvotes: 4

Related Questions