Reputation: 445
In QT using QFileDialog's getExistingDirectory, how can I start in a directory specified by an environment variable?
That is to say, how can I do this:
return QFileDialog::getExistingDirectory(0, "Open Directory", "%HOME%", QFileDialog::ShowDirsOnly);
Where %HOME% is the Windows Envirnment Variable to the user's home usually found in C:\Users\UserName
Thanks.
Upvotes: 1
Views: 2637
Reputation: 3038
The answer would probably be:
return QFileDialog::getExistingDirectory(0, "Open Directory", getenv("HOME"), QFileDialog::ShowDirsOnly);
getenv
is declared in stdlib.h
Upvotes: 4