[Qt-creator] Configure script file path in QtCreator options and read it in plugin code

Eike Ziller Eike.Ziller at qt.io
Tue Dec 12 09:08:19 CET 2017



> On 12. Dec 2017, at 07:40, Vidhya Arun <svidhyapria at gmail.com> wrote:
> 
> Hello 

Hi,

> 
> I have a Qt creator plugin written where a perl script is called to perform the required functionality. The perl script is located in a specific path in my linux machine and there is a parameter passed to it. Currently I am invoking this perl script with the hardcoded path and parameter directly from my plugin. Whenever there is a change in the path or parameter of the perl script, my plugin code also got to be changed.
> 
> Is there a possibility where I can configure the perl script path in some Tools-options of Qtcreator and read this path directly from plugin ? This will ensure plugin code remains untouched for any changes in perl script.

Core::ICore::settings() returns a QSettings object that works on the Qt Creator settings (on Linux located at ~/.config/QtProject/QtCreator.ini). You can use that in your plugin to write and read any settings, also custom ones for your plugin.
If you want to add a page to Tools > Options, have a look at the Core::IOptionsPage class (<coreplugin/dialogs/optionspage.h>) and how it is used in the other plugins.

Br, Eike

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list