ToolPresetManager Class Reference

The ToolPresetManager JavaScript class. Provides methods to set the current tool preset. More...

Public Slots

void setActivePreset (QScriptValue preset)
 
QScriptValue getPresets ()
 

Detailed Description

The ToolPresetManager JavaScript class. Provides methods to set the current tool preset.

The tool preset manager returns information about the existing tool presets and provides to the user the functionality to select a tool preset with its "id" property. Presets can be defined by the following properties:

  • id (String)
  • name (String)
// Activate the Preset named "preset"
var toolPresetManager = new ToolPresetManager();
var presets = toolPresetManager.getPresets();
presets.forEach(
function(preset)
{
if(preset.name == "preset")
toolPresetManager.setActivePreset(preset);
}
);

Member Function Documentation

◆ getPresets

QScriptValue ToolPresetManager::getPresets ( )
slot

Get all the presets of the project.

Returns
An array of JavaScript objects with the "id" and "name" properties set.

◆ setActivePreset

void ToolPresetManager::setActivePreset ( QScriptValue  preset)
slot

Activate the given preset.

Parameters
presetA JavaScript object with the "id" property set to the desired tool preset