summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_script_qscriptable.cpp
blob: 3a02d51823f0127ecd3954b69762a4ef82f8492b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! [0]
class MyScriptableObject: public QObject,
      protected QScriptable
{
    Q_OBJECT
...

public slots:
    void doSomething();
    double doSomethingElse();
}
//! [0]


//! [1]
void MyScriptableObject::doSomething()
{
  context()->throwError("Threw an error from a slot");
}

double MyScriptableObject::doSomethingElse()
{
  return qscriptvalue_cast<double>(thisObject());
}
//! [1]