summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-03-24 13:05:38 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-03-24 13:09:32 (GMT)
commit9540e2b5d67af9a26f431c3e8636bff9946e88c4 (patch)
treeb040515bf5b541a82f8a3a8cdd809777ac2b71dd /src/script
parent739f15838f73e84cb5e5ae58bb8adc267bc1b79c (diff)
downloadQt-9540e2b5d67af9a26f431c3e8636bff9946e88c4.zip
Qt-9540e2b5d67af9a26f431c3e8636bff9946e88c4.tar.gz
Qt-9540e2b5d67af9a26f431c3e8636bff9946e88c4.tar.bz2
QtScript: Add QObjectWrapOption for not exposing slots
This makes it possible to have a prototype object in place that handles all slot calls, rather than having the slots be recreated in each wrapper object. Task-number: QTBUG-3637 Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp1
-rw-r--r--src/script/api/qscriptengine.h1
-rw-r--r--src/script/bridge/qscriptqobject.cpp3
3 files changed, 4 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 356b4d0..2650d7f 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -292,6 +292,7 @@ QT_BEGIN_NAMESPACE
\value ExcludeSuperClassProperties The script object will not expose properties inherited from the superclass.
\value ExcludeSuperClassContents Shorthand form for ExcludeSuperClassMethods | ExcludeSuperClassProperties
\value ExcludeDeleteLater The script object will not expose the QObject::deleteLater() slot.
+ \value ExcludeSlots The script object will not expose the QObject's slots.
\value AutoCreateDynamicProperties Properties that don't already exist in the QObject will be created as dynamic properties of that object, rather than as properties of the script object.
\value PreferExistingWrapperObject If a wrapper object with the requested configuration already exists, return that object.
\value SkipMethodsInEnumeration Don't include methods (signals and slots) when enumerating the object's properties.
diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h
index 2ce3183..76461bc 100644
--- a/src/script/api/qscriptengine.h
+++ b/src/script/api/qscriptengine.h
@@ -125,6 +125,7 @@ public:
ExcludeSuperClassContents = 0x0006,
SkipMethodsInEnumeration = 0x0008,
ExcludeDeleteLater = 0x0010,
+ ExcludeSlots = 0x0020,
AutoCreateDynamicProperties = 0x0100,
PreferExistingWrapperObject = 0x0200
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 765e074..83a811b 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -151,7 +151,8 @@ private:
static bool hasMethodAccess(const QMetaMethod &method, int index, const QScriptEngine::QObjectWrapOptions &opt)
{
return (method.access() != QMetaMethod::Private)
- && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater));
+ && ((index != 2) || !(opt & QScriptEngine::ExcludeDeleteLater))
+ && (!(opt & QScriptEngine::ExcludeSlots) || (method.methodType() != QMetaMethod::Slot));
}
static bool isEnumerableMetaProperty(const QMetaProperty &prop,