source: trunk/doc/src/snippets/code/src_script_qscriptable.cpp@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 392 bytes
Line 
1//! [0]
2class MyScriptableObject: public QObject,
3 protected QScriptable
4{
5 Q_OBJECT
6...
7
8public slots:
9 void doSomething();
10 double doSomethingElse();
11}
12//! [0]
13
14
15//! [1]
16void MyScriptableObject::doSomething()
17{
18 context()->throwError("Threw an error from a slot");
19}
20
21double MyScriptableObject::doSomethingElse()
22{
23 return qscriptvalue_cast<double>(thisObject());
24}
25//! [1]
Note: See TracBrowser for help on using the repository browser.