Home · Overviews · Reference · Classes codeless banner

Object Javascript Class Reference

The Object class encapsulates a node within a project. Nodes may have further subnodes (properies) and a list value. Object's cannot be instantiated directly, but should be accessed through the Project.property() or QMake_Object() methods.

Properties

name: string

Returns the name of the Object. For example, in the following .pro snippet:

    games_category.hint = desktop

the assigned object name is "hint".

absName: string

Returns the absolute name of the Object. The absolute name is the entire path required to access the object from any project file. For example, in the following .pro snippet:

    games_category.hint = desktop

the absolute name might be "/src/libraries/qtopia.games_category.files".

Methods

value(): list<string>

Returns the current Object value.

isEmpty(): boolean

Returns true if the value is empty (either null or a single empty string), otherwise false.

properties(): list<string>

Returns a list of all the Object's properties.

property(property): Object

Returns the Object's property. If the property does not exist, it is created unless the project is read-only, in which case a null Object is returned.

setValue(value): null

Set the Object's current value. value may be a string, or a list of strings. This is equivalent to the "=" .pro operator.

Note that calling object.setValue("") clears the value, it does not create a single item that is an empty string.

clear(): null

Clear the Object's current value. This includes all properties. To clear just the value use setValue("") instead of clear().

append(value): null

Append value to the Object's value. value may be a string, or a list of strings. This is equivalent to the "+=" .pro operator.

unite(value): null

Unite value with the Object's value. value may be a string, or a list of strings. Uniting a value means to append if the value does not already contain the entry, otherwise do nothing. This is equivalent to the "*=" .pro operator.

remove(value): null

Remove value from the Object's value. value may be a string, or a list of strings. This is equivalent to the "-=" .pro operator.

find(propertyName[, value]): list<string>

Return the absolute names of Object's that have a property named propertyName that contains the value. value may not be a list. The current object, and all its children are searched.

The absoulte name of an Object may be passed to QMake_Object() to retrieve the Object instance.

If value is omitted, any objects that have the property propertyName will be returned.

isProperty(property): boolean

Returns true if the object has a property.

contains(value): boolean

Returns true if the Object value contains value, otherwise false. value may not be a list.

strValue(value): string

Returns the current Object value. If the value is a list, is is joined into a single string with a single space separator (" ").

assignValue(): string

Returns the current Object value as a quoted string. The string returned could be used in a .pro file to establish an object with the same name.

watch(functionname): null

The function functionname will be called every time the object changes. Note that you should quote the function name.

    project.property("FOO").watch("myfunc");

Note: Overuse of this function could have dire effects on the performance of qbuild.

See also Javascript Binding.


Copyright © 2009 Trolltech
Qt Extended - QBuild Maintainer Guide