[Qt-creator] Finding Qt bin for Kit
Hunger Tobias
Tobias.Hunger at theqtcompany.com
Tue Sep 22 13:33:04 CEST 2015
Hi Janne,
On Tue, Sep 22, 2015 at 12:30 PM, Janne Koskinen <koshuin at gmail.com> wrote:
>> See QtKitInformation in ./src/plugins/qtsupport/qtkitinformation.h
>>
>> I think what are you looking for is:
>> static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k);
>> and BaseQtVersion::binPath() or BaseQtVersion::qmakeCommand()
>
> Thanks, it works :)
>
> <snip>
> ProjectExplorer::Project *pro =
> ProjectExplorer::SessionManager::projectForFile(selectedFile);
>
> QtSupport::BaseQtVersion *qtVersion =
> QtSupport::QtKitInformation::qtVersion(pro->activeTarget()->kit());
Please note that qtVersion may be 0 here. A kit does not have to have a Qt version set after all.
> Utils::FileName bin = qtVersion->binPath();
> </snip>
In many places in the Qt Creator UI (e.g. for external tools, run arguments, etc.) that path should also be available as "%{CurrentProject:QT_HOST_BINS}" (or %{CurrentProject:QT_INSTALL_BINS}). So maybe you can get away without C++ code.
Best Regards,
Tobias
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Qt-creator
mailing list