Backdrop Class Reference

The Backdrop JavaScript global object. Get, set and add backdrops. More...

Public Slots

QScriptValue backdrops (String &group)
 Return the backdrops of a group. More...
bool setBackdrops (String &group, QScriptValue &backdrops)
bool addBackdrop (String &group, QScriptValue &backdrop)

Detailed Description

The Backdrop JavaScript global object. Get, set and add backdrops.

The Backdrop methods sometimes use backdrop JavaScript objects which are described as follows:

"position" : {"x":-1030, "y":-1191, "w":376, "h":284},
"title" : {"text":"HAIR", "color":4278190080,"size":14, "font":"Arial"},
"description" : {"text":"This backdrop include all the modules of hair.\n", "color":4278190080, "size":14, "font":"Arial"},
"color" : 4286859713

Color is a integer representation of a RGBA value. It can be obtained with the following computation.

function fromRGBAtoInt(r, g, b, a)
return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);

Here's an example demonstrating how to customize a backdrop

// Get every backdrop in my group.
var myGroupPath = "Top/MyGroup";
var myBackdrops = Backdrop.backdrops(myGroupPath);
for(var i=0; i<myBackdrops.length; i++)
if(myBackdrops[i].title.text == "MyBackdrop")
myBackdrops[i].color = fromRGBAtoInt(0, 0, 255, 255);
// Replace the original backdrops with their edited version.
Backdrop.setBackdrops(myGroupPath, myBackdrops);

Member Function Documentation

◆ addBackdrop

bool Backdrop::addBackdrop ( String &  group,
QScriptValue &  backdrop 

Add a single backdrop. The new backdrop is displayed on top of all the others.

var myBackdrop =
"position" : {"x": -100, "y" :-100, "w":300, "h":300},
"title" : {"text" : "My Title", "color" : fromRGBAtoInt(255, 100, 100, 255), "size" : 14, "font" : "Arial"},
"description" : {"text" : "This is a new backdrop that will include the node covered by its area.\n", "color" : fromRGBAtoInt(100, 255, 100, 255), "size" : 14, "font" : "Arial"},
"color" : fromRGBAtoInt(100, 100, 0, 255)
Backdrop.addBackdrop("Top/MyGroup", myBackdrop);
group- The name of the parent group node.
backdrop- A backdrop JavaScript object, as described in the Backdrop class description.
true if the backdrop was added.

◆ backdrops

QScriptValue Backdrop::backdrops ( String &  group)

Return the backdrops of a group.

This method returns an array of JavaScript objects where each object represent a single backdrop. Since backdrop do not have keys/unique ID, all backdrops are returned in the order they are defined in the group. The group node must be provided as input.

groupname of the group node.
an array of backdrop object

◆ setBackdrops

bool Backdrop::setBackdrops ( String &  group,
QScriptValue &  backdrops 

Set the backdrops for the specified group. This replaces all the backdrops in the group. The backdrop is in the format as the array returned by 'Backdrop.backdrops(group). The code will parse the JavaScript object, as described in the Backdrop class description.

groupthe name of the group node.
backdropsan array of backdrop objects or a single backdrop object. See the Backdrop class description for information on the backdrop object.
true if the operation was done on a valid group.