Fix bug 1016 - "Calling of Q_INVOKABLE method returning not QVariant is impossible..."
This commit is contained in:
parent
f55d088d44
commit
15ceed791f
7 changed files with 163 additions and 18 deletions
|
|
@ -12,11 +12,13 @@ add_definitions(-DRXX_ALLOCATOR_INIT_0)
|
|||
set(pysidetest_SRC
|
||||
testobject.cpp
|
||||
testview.cpp
|
||||
hiddenobject.cpp
|
||||
)
|
||||
|
||||
set(pysidetest_MOC_HEADERS
|
||||
testobject.h
|
||||
testview.h
|
||||
hiddenobject.h
|
||||
)
|
||||
|
||||
qt4_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
|
||||
|
|
@ -86,3 +88,4 @@ PYSIDE_TEST(signalwithdefaultvalue_test.py)
|
|||
PYSIDE_TEST(signalemissionfrompython_test.py)
|
||||
PYSIDE_TEST(version_test.py)
|
||||
PYSIDE_TEST(typedef_signal_test.py)
|
||||
PYSIDE_TEST(bug_1016.py)
|
||||
|
|
|
|||
12
tests/pysidetest/bug_1016.py
Normal file
12
tests/pysidetest/bug_1016.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from testbinding import *
|
||||
import unittest
|
||||
|
||||
class TestBug1016 (unittest.TestCase):
|
||||
|
||||
def testIt(self):
|
||||
obj = getHiddenObject()
|
||||
self.assertEqual(obj.callMe(), None)
|
||||
self.assertTrue(obj.wasCalled())
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
38
tests/pysidetest/hiddenobject.cpp
Normal file
38
tests/pysidetest/hiddenobject.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This file is part of the PySide project.
|
||||
*
|
||||
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
*
|
||||
* Contact: PySide team <contact@pyside.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "hiddenobject.h"
|
||||
|
||||
void HiddenObject::callMe()
|
||||
{
|
||||
m_called = true;
|
||||
}
|
||||
|
||||
bool HiddenObject::wasCalled()
|
||||
{
|
||||
return m_called;
|
||||
}
|
||||
|
||||
QObject* getHiddenObject()
|
||||
{
|
||||
return new HiddenObject();
|
||||
}
|
||||
49
tests/pysidetest/hiddenobject.h
Normal file
49
tests/pysidetest/hiddenobject.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This file is part of the PySide project.
|
||||
*
|
||||
* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
*
|
||||
* Contact: PySide team <contact@pyside.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef HIDDENOBJECT_H
|
||||
#define HIDDENOBJECT_H
|
||||
|
||||
#ifdef pysidetest_EXPORTS
|
||||
#define PYSIDE_EXPORTS 1
|
||||
#endif
|
||||
#include "pysidemacros.h"
|
||||
#include <QObject>
|
||||
|
||||
// This class shouldn't be exported!
|
||||
class HiddenObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HiddenObject() : m_called(false) {}
|
||||
Q_INVOKABLE void callMe();
|
||||
public slots:
|
||||
bool wasCalled();
|
||||
private:
|
||||
bool m_called;
|
||||
};
|
||||
|
||||
// Return a instance of HiddenObject
|
||||
PYSIDE_API QObject* getHiddenObject();
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
#include <pyside_global.h>
|
||||
// PySide global.h file
|
||||
#include "pyside_global.h"
|
||||
#include "testobject.h"
|
||||
#include "testview.h"
|
||||
#define PYSIDE_API
|
||||
#include "hiddenobject.h"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
<primitive-type name="TypedefValue"/>
|
||||
<object-type name="TestObject" />
|
||||
|
||||
<function signature="getHiddenObject()" />
|
||||
|
||||
<inject-code position="end">
|
||||
Shiboken::TypeResolver::createObjectTypeResolver< ::PySideCPP2::TestObjectWithoutNamespace>("TestObjectWithoutNamespace*");
|
||||
Shiboken::TypeResolver::createValueTypeResolver< ::PySideCPP2::PySideLong>("PySideLong");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue