Don't export functions not used outsise libpyside and move them to an private header.
This commit is contained in:
parent
9257cd1783
commit
16ccce72d8
6 changed files with 161 additions and 121 deletions
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#include "qsignal.h"
|
#include "qsignal.h"
|
||||||
#include "qproperty.h"
|
#include "qproperty.h"
|
||||||
|
#include "qproperty_p.h"
|
||||||
|
|
||||||
#define MAX_SIGNALS_COUNT 50
|
#define MAX_SIGNALS_COUNT 50
|
||||||
#define MAX_SLOTS_COUNT 50
|
#define MAX_SLOTS_COUNT 50
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "pyside.h"
|
#include "pyside.h"
|
||||||
#include "signalmanager.h"
|
#include "signalmanager.h"
|
||||||
|
#include "qproperty_p.h"
|
||||||
#include "qproperty.h"
|
#include "qproperty.h"
|
||||||
#include "qsignal.h"
|
#include "qsignal.h"
|
||||||
#include <basewrapper.h>
|
#include <basewrapper.h>
|
||||||
|
|
@ -33,7 +34,6 @@
|
||||||
|
|
||||||
extern "C" void init_signal(PyObject* module);
|
extern "C" void init_signal(PyObject* module);
|
||||||
extern "C" void init_slot(PyObject* module);
|
extern "C" void init_slot(PyObject* module);
|
||||||
extern "C" void init_qproperty(PyObject* module);
|
|
||||||
|
|
||||||
static QStack<PySide::CleanupFunction> cleanupFunctionList;
|
static QStack<PySide::CleanupFunction> cleanupFunctionList;
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ void init(PyObject *module)
|
||||||
{
|
{
|
||||||
init_signal(module);
|
init_signal(module);
|
||||||
init_slot(module);
|
init_slot(module);
|
||||||
init_qproperty(module);
|
initQProperty(module);
|
||||||
// Init signal manager, so it will register some meta types used by QVariant.
|
// Init signal manager, so it will register some meta types used by QVariant.
|
||||||
SignalManager::instance();
|
SignalManager::instance();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "qproperty.h"
|
#include "qproperty.h"
|
||||||
|
#include "qproperty_p.h"
|
||||||
#include "dynamicqmetaobject_p.h"
|
#include "dynamicqmetaobject_p.h"
|
||||||
|
|
||||||
#define QPROPERTY_CLASS_NAME "Property"
|
#define QPROPERTY_CLASS_NAME "Property"
|
||||||
|
|
@ -32,6 +33,9 @@
|
||||||
namespace PySide
|
namespace PySide
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// aux function
|
||||||
|
static char* translateTypeName(PyObject*);
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -52,11 +56,8 @@ typedef struct {
|
||||||
bool final;
|
bool final;
|
||||||
} QPropertyData;
|
} QPropertyData;
|
||||||
|
|
||||||
static int qproperty_init(PyObject*, PyObject*, PyObject*);
|
static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
|
||||||
static void qproperty_free(void*);
|
static void qpropertyFree(void*);
|
||||||
|
|
||||||
//aux
|
|
||||||
static char* translate_type_name(PyObject*);
|
|
||||||
|
|
||||||
PyTypeObject QProperty_Type = {
|
PyTypeObject QProperty_Type = {
|
||||||
PyObject_HEAD_INIT(0)
|
PyObject_HEAD_INIT(0)
|
||||||
|
|
@ -95,10 +96,10 @@ PyTypeObject QProperty_Type = {
|
||||||
0, /*tp_descr_get */
|
0, /*tp_descr_get */
|
||||||
0, /*tp_descr_set */
|
0, /*tp_descr_set */
|
||||||
0, /*tp_dictoffset */
|
0, /*tp_dictoffset */
|
||||||
(initproc)qproperty_init, /*tp_init */
|
qpropertyTpInit, /*tp_init */
|
||||||
0, /*tp_alloc */
|
0, /*tp_alloc */
|
||||||
PyType_GenericNew, /*tp_new */
|
PyType_GenericNew, /*tp_new */
|
||||||
qproperty_free, /*tp_free */
|
qpropertyFree, /*tp_free */
|
||||||
0, /*tp_is_gc */
|
0, /*tp_is_gc */
|
||||||
0, /*tp_bases */
|
0, /*tp_bases */
|
||||||
0, /*tp_mro */
|
0, /*tp_mro */
|
||||||
|
|
@ -108,7 +109,9 @@ PyTypeObject QProperty_Type = {
|
||||||
0, /*tp_del */
|
0, /*tp_del */
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_qproperty(PyObject* module)
|
} // extern "C"
|
||||||
|
|
||||||
|
void initQProperty(PyObject* module)
|
||||||
{
|
{
|
||||||
if (PyType_Ready(&QProperty_Type) < 0)
|
if (PyType_Ready(&QProperty_Type) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -117,9 +120,7 @@ void init_qproperty(PyObject* module)
|
||||||
PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type));
|
PyModule_AddObject(module, QPROPERTY_CLASS_NAME, ((PyObject*)&QProperty_Type));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
|
||||||
|
|
||||||
int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds)
|
|
||||||
{
|
{
|
||||||
PyObject* type = 0;
|
PyObject* type = 0;
|
||||||
QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
|
QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
|
||||||
|
|
@ -141,11 +142,11 @@ int qproperty_init(PyObject* self, PyObject* args, PyObject* kwds)
|
||||||
if (!data->fset && data->fget)
|
if (!data->fset && data->fget)
|
||||||
data->constant = true;
|
data->constant = true;
|
||||||
|
|
||||||
data->typeName = translate_type_name(type);
|
data->typeName = translateTypeName(type);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qproperty_free(void *self)
|
void qpropertyFree(void *self)
|
||||||
{
|
{
|
||||||
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
|
PyObject *pySelf = reinterpret_cast<PyObject*>(self);
|
||||||
QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
|
QPropertyData *data = reinterpret_cast<QPropertyData*>(self);
|
||||||
|
|
@ -226,7 +227,7 @@ PyObject* qpropertyGetObject(PyObject* source, PyObject* name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* translate_type_name(PyObject* type)
|
char* translateTypeName(PyObject* type)
|
||||||
{
|
{
|
||||||
if (PyType_Check(type)) {
|
if (PyType_Check(type)) {
|
||||||
char *typeName = NULL;
|
char *typeName = NULL;
|
||||||
|
|
|
||||||
|
|
@ -58,26 +58,6 @@ PYSIDE_API int qpropertySet(PyObject* self, PyObject* source, PyObject* value);
|
||||||
**/
|
**/
|
||||||
PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source);
|
PYSIDE_API PyObject* qpropertyGet(PyObject* self, PyObject* source);
|
||||||
|
|
||||||
/**
|
|
||||||
* This function call reset property function
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @param source The QObject witch has the property
|
|
||||||
* @return Return 0 if ok or -1 if this function fail
|
|
||||||
**/
|
|
||||||
PYSIDE_API int qpropertyReset(PyObject* self, PyObject* source);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function return the property type
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return the property type name
|
|
||||||
**/
|
|
||||||
PYSIDE_API const char* qpropertyGetType(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function search in the source object for desired property
|
* This function search in the source object for desired property
|
||||||
*
|
*
|
||||||
|
|
@ -87,89 +67,6 @@ PYSIDE_API const char* qpropertyGetType(PyObject* self);
|
||||||
**/
|
**/
|
||||||
PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name);
|
PYSIDE_API PyObject* qpropertyGetObject(PyObject* source, PyObject* name);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has read function
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsReadable(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has write function
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsWritable(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has reset function
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyHasReset(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag DESIGNABLE setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsDesignable(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag SCRIPTABLE setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsScriptable(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag STORED setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsStored(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag USER setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsUser(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag CONSTANT setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsConstant(PyObject* self);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function check if property has the flag FINAL setted
|
|
||||||
* This function does not check the property object type
|
|
||||||
*
|
|
||||||
* @param self The property object
|
|
||||||
* @return Return a boolean value
|
|
||||||
**/
|
|
||||||
PYSIDE_API bool qpropertyIsFinal(PyObject* self);
|
|
||||||
|
|
||||||
|
|
||||||
} //namespace PySide
|
} //namespace PySide
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
139
libpyside/qproperty_p.h
Normal file
139
libpyside/qproperty_p.h
Normal file
|
|
@ -0,0 +1,139 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the PySide project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 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 PYSIDE_QPROPERTY_P_H
|
||||||
|
#define PYSIDE_QPROPERTY_P_H
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
|
namespace PySide
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init PySide QProperty support system
|
||||||
|
*/
|
||||||
|
void initQProperty(PyObject* module);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function call reset property function
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @param source The QObject witch has the property
|
||||||
|
* @return Return 0 if ok or -1 if this function fail
|
||||||
|
**/
|
||||||
|
int qpropertyReset(PyObject* self, PyObject* source);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function return the property type
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return the property type name
|
||||||
|
**/
|
||||||
|
const char* qpropertyGetType(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has read function
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsReadable(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has write function
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsWritable(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has reset function
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyHasReset(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag DESIGNABLE setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsDesignable(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag SCRIPTABLE setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsScriptable(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag STORED setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsStored(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag USER setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsUser(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag CONSTANT setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsConstant(PyObject* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function check if property has the flag FINAL setted
|
||||||
|
* This function does not check the property object type
|
||||||
|
*
|
||||||
|
* @param self The property object
|
||||||
|
* @return Return a boolean value
|
||||||
|
**/
|
||||||
|
bool qpropertyIsFinal(PyObject* self);
|
||||||
|
|
||||||
|
} // namespace PySide
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -21,8 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "signalmanager.h"
|
#include "signalmanager.h"
|
||||||
#include "qproperty.h"
|
|
||||||
#include "pyside.h"
|
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
@ -35,6 +33,10 @@
|
||||||
#include <basewrapper.h>
|
#include <basewrapper.h>
|
||||||
#include <conversions.h>
|
#include <conversions.h>
|
||||||
|
|
||||||
|
#include "qproperty.h"
|
||||||
|
#include "qproperty_p.h"
|
||||||
|
#include "pyside.h"
|
||||||
|
|
||||||
#if QSLOT_CODE != 1 || QSIGNAL_CODE != 2
|
#if QSLOT_CODE != 1 || QSIGNAL_CODE != 2
|
||||||
#error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value!
|
#error QSLOT_CODE and/or QSIGNAL_CODE changed! change the hardcoded stuff to the correct value!
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue