aboutsummaryrefslogtreecommitdiffstats
path: root/qtbindings/qtscript_core/include/__package_shared.h
blob: 5db4253f59a139d14d1223f6bc37a2826f124e0a (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <qcoreevent.h>

#include <QtScript/qscriptvalue.h>
#include <QtScript/QScriptEngine>


#include <QFile>


Q_DECLARE_METATYPE(QEvent)

namespace QtMetaTypePrivate {

template <>
inline void *QMetaTypeFunctionHelper<QEvent, true>::Construct(void *where, const void *t)
{
    if (t)
        return new (where) QEvent(*static_cast<const QEvent*>(t));
    return new (where) QEvent(QEvent::None);
};


}

template <>
inline QEvent qscriptvalue_cast<QEvent>(const QScriptValue &value)
{
    QEvent t(QEvent::None);
    const int id = qMetaTypeId<QEvent>();

    if (qscriptvalue_cast_helper(value, id, &t))
        return t;

    return QEvent(QEvent::None);
}