Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
220f6b43
Commit
220f6b43
authored
Feb 10, 2010
by
Roberto Raggi
Browse files
Register the `Qt' and the `console' object.
parent
caedef35
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/qmljs/qmljsinterpreter.cpp
View file @
220f6b43
...
...
@@ -1410,6 +1410,7 @@ Engine::Engine()
_regexpCtor
(
0
),
_globalObject
(
0
),
_mathObject
(
0
),
_qtObject
(
0
),
#ifndef NO_DECLARATIVE_BACKEND
_qmlKeysObject
(
0
),
#endif
...
...
@@ -1566,6 +1567,11 @@ const ObjectValue *Engine::mathObject() const
return
_mathObject
;
}
const
ObjectValue
*
Engine
::
qtObject
()
const
{
return
_qtObject
;
}
void
Engine
::
registerValue
(
Value
*
value
)
{
_registeredValues
.
append
(
value
);
...
...
@@ -1856,6 +1862,40 @@ void Engine::initializePrototypes()
_globalObject
->
setProperty
(
"Number"
,
numberCtor
());
_globalObject
->
setProperty
(
"Date"
,
dateCtor
());
_globalObject
->
setProperty
(
"RegExp"
,
regexpCtor
());
//types
_qtObject
=
newObject
(
/*prototype */
0
);
addFunction
(
_qtObject
,
QLatin1String
(
"rgba"
),
4
);
addFunction
(
_qtObject
,
QLatin1String
(
"hsla"
),
4
);
addFunction
(
_qtObject
,
QLatin1String
(
"rect"
),
4
);
addFunction
(
_qtObject
,
QLatin1String
(
"point"
),
2
);
addFunction
(
_qtObject
,
QLatin1String
(
"size"
),
2
);
addFunction
(
_qtObject
,
QLatin1String
(
"vector3d"
),
3
);
//color helpers
addFunction
(
_qtObject
,
QLatin1String
(
"lighter"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"darker"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"tint"
),
2
);
//misc methods
addFunction
(
_qtObject
,
QLatin1String
(
"closestAngle"
),
2
);
addFunction
(
_qtObject
,
QLatin1String
(
"playSound"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"openUrlExternally"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"md5"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"btoa"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"atob"
),
1
);
addFunction
(
_qtObject
,
QLatin1String
(
"quit"
),
0
);
addFunction
(
_qtObject
,
QLatin1String
(
"resolvedUrl"
),
1
);
//firebug/webkit compat
ObjectValue
*
consoleObject
=
newObject
(
/*prototype */
0
);
addFunction
(
consoleObject
,
QLatin1String
(
"log"
),
1
);
addFunction
(
consoleObject
,
QLatin1String
(
"debug"
),
1
);
_globalObject
->
setProperty
(
QLatin1String
(
"console"
),
consoleObject
);
_globalObject
->
setProperty
(
QLatin1String
(
"Qt"
),
_qtObject
);
}
const
ObjectValue
*
Engine
::
qmlKeysObject
()
...
...
src/libs/qmljs/qmljsinterpreter.h
View file @
220f6b43
...
...
@@ -547,6 +547,7 @@ public:
// global object
ObjectValue
*
globalObject
()
const
;
const
ObjectValue
*
mathObject
()
const
;
const
ObjectValue
*
qtObject
()
const
;
// prototypes
ObjectValue
*
objectPrototype
()
const
;
...
...
@@ -608,6 +609,7 @@ private:
ObjectValue
*
_globalObject
;
ObjectValue
*
_mathObject
;
ObjectValue
*
_qtObject
;
#ifndef NO_DECLARATIVE_BACKEND
ObjectValue
*
_qmlKeysObject
;
#endif
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment