#ifndef _PYTHONQT_H
#define _PYTHONQT_H
/*
*
* Copyright (C) 2010 MeVis Medical Solutions AG All Rights Reserved.
*
* 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.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact information: MeVis Medical Solutions AG, Universitaetsallee 29,
* 28359 Bremen, Germany or:
*
* http://www.mevis.de
*
*/
//----------------------------------------------------------------------------------
/*!
// \file PythonQt.h
// \author Florian Link
// \author Last changed by $Author: florian $
// \date 2006-05
*/
//----------------------------------------------------------------------------------
#include "PythonQtUtils.h"
#include "PythonQtSystem.h"
#include "PythonQtInstanceWrapper.h"
#include "PythonQtClassWrapper.h"
#include "PythonQtSlot.h"
#include "PythonQtObjectPtr.h"
#include "PythonQtStdIn.h"
#include <QObject>
#include <QVariant>
#include <QList>
#include <QHash>
#include <QByteArray>
#include <QStringList>
#include <QtDebug>
#include <iostream>
class PythonQtClassInfo;
class PythonQtPrivate;
class PythonQtMethodInfo;
class PythonQtSignalReceiver;
class PythonQtImportFileInterface;
class PythonQtCppWrapperFactory;
class PythonQtForeignWrapperFactory;
class PythonQtQFileImporter;
typedef void PythonQtVoidPtrCB(void* object);
typedef void PythonQtQObjectWrappedCB(QObject* object);
typedef void PythonQtQObjectNoLongerWrappedCB(QObject* object);
typedef void* PythonQtPolymorphicHandlerCB(const void *ptr, const char **class_name);
typedef void PythonQtShellSetInstanceWrapperCB(void* object, PythonQtInstanceWrapper* wrapper);
template<class T> void PythonQtSetInstanceWrapperOnShell(void* object, PythonQtInstanceWrapper* wrapper) {
(reinterpret_cast<T*>(object))->_wrapper = wrapper;
}
//! Helper template that allows to pass the ownership of a C++ instance between C++ and Python
//! (it is used as a slot return type or parameter type so that it can be detected by the PythonQt
//! slot calling code).
template<class T>
class PythonQtPassOwnershipToCPP
{
public:
//! Allow conversion from T to PythonQtPassOwnershipToCPP<T>
PythonQtPassOwnershipToCPP(const T& t):_t(t) {}
//! Allow conversion from PythonQtPassOwnershipToCPP<T> to T
operator T() const { return _t; }
//! Stored value. This is important so that it has the same memory layout
//! as a pointer if T is a pointer type (which is the typical use case for this class).
T _t;
};
//! Helper template that allows to pass the ownership of a C++ instance between C++ and Python
//! (it is used as a slot return type or parameter type so that it can be detected by the PythonQt
//! slot calling code).
template<class T>
class PythonQtPassOwnershipToPython
{
public:
//! Allow conversion from T to PythonQtPassOwnershipToPython<T>
PythonQtPassOwnershipToPython(const T& t):_t(t) {}
//! Allow conversion from PythonQtPassOwnershipToPython<T> to T
operator T() const { return _t; }
//! Stored value. This is important so that it has the same memory layout
//! as a pointer if T is a pointer type (which is the typical use case for this class).
T _t;
};
//! Helper template that allows to pass the ownership of a C++ instance between C++ and Python
//! (it is used as a slot return type or parameter type so that it can be detected by the PythonQt
//! slot calling code).
template<class T>
class PythonQtNewOwnerOfThis
{
public:
//! Allow conversion from T to PythonQtNewOwnerOfThis<T>
PythonQtNewOwnerOfThis(const T& t):_t(t) {}
//! Allow conversion from PythonQtNewOwnerOfThis<T> to T
operator T() const { return _t; }
//! Stored value. This is important so that it has the same memory layout
//! as a pointer if T is a pointer type (which is the typical use case for this class).
T _t;
};
//! returns the offset that needs to be added to upcast an object of type T1 to T2
template<class T1, class T2> int PythonQtUpcastingOffset() {
return ((reinterpret_cast<char*>(static_cast<T2*>(reinterpret_cast<T1*>(0x100))))
- (reinterpret_cast<char*>(reinterpret_cast<T1*>(0x100))));
}
//! callback to create a QObject lazily
typedef QObject* PythonQtQObjectCreatorFunctionCB();
//! helper template to create a derived QObject class
template<class T> QObject* PythonQtCreateObject() { return new T(); };
//! The main interface to the Python Qt binding, realized as a singleton
/*!
Use PythonQt::init() to initialize the singleton and PythonQt::self() to access it.
While there can be only one PythonQt instance, you can have any number of Python context to do scripting in.
One possibility is to use createModuleFromFile(), createModuleFromScript() or createUniqueModule() to get a context
that is separated from the other contexts. Alternatively you can use Python dicts as contexts for script evaluation,
but you will need to populate the dict with the __builtins__ instance to have all Pythons available when running
code in the scope of a dict.
*/
class PYTHONQT_EXPORT PythonQt : public QObject {
Q_OBJECT
public:
//! flags that can be passed to PythonQt::init()
enum InitFlags {
RedirectStdOut = 1, //!<< sets if the std out/err is redirected to pythonStdOut() and pythonStdErr() signals
IgnoreSiteModule = 2, //!<< sets if Python should ignore the site module
ExternalHelp = 4, //!<< sets if help() calls on PythonQt modules are forwarded to the pythonHelpRequest() signal
PythonAlreadyInitialized = 8 //!<< sets that PythonQt should not can PyInitialize, since it is already done
};
//! flags that tell PythonQt which operators to expect on the registered type
enum TypeSlots {
Type_Add = 1,
Type_Subtract = 1 << 1,
Type_Multiply = 1 << 2,
Type_Divide = 1 << 3,
Type_Mod = 1 << 4,
Type_And = 1 << 5,
Type_Or = 1 << 6,
Type_Xor = 1 << 7,
Type_LShift = 1 << 8,
Type_RShift = 1 << 9,
Type_InplaceAdd = 1 << 10,
Type_InplaceSubtract = 1 << 11,
Type_InplaceMultiply = 1 << 12,
Type_InplaceDivide = 1 << 13,
Type_InplaceMod = 1 << 14,
Type_InplaceAnd = 1 << 15,
Type_InplaceOr = 1 << 16,
Type_InplaceXor = 1 << 17,
Type_InplaceLShift = 1 << 18,
Type_InplaceRShift = 1 << 19,
Type_Length = 1 << 20,
Type_MappingSetItem = 1 << 21,
Type_MappingGetItem = 1 << 22,
Type_Invert = 1 << 29,
Type_RichCompare = 1 << 30,
Type_NonZero = 1 << 31,
};
//! enum for profiling callback
enum ProfilingCallbackState {
Enter = 1,
Leave = 2
};
//! callback for profiling. className and methodName are only passed when state == Enter, otherwise
//! they are NULL.
typedef void ProfilingCB(ProfilingCallbackState state, const char* classN
没有合适的资源?快使用搜索试试~ 我知道了~
PythonQt3.0-win-x86-Qt5.5.1-Python2.7.11-debug-release
共45个文件
h:25个
lib:6个
dll:6个
5星 · 超过95%的资源 需积分: 17 61 下载量 135 浏览量
2016-04-19
18:44:40
上传
评论 2
收藏 30.07MB ZIP 举报
温馨提示
这个是vs2010编译的PythonQt3.0,依赖版本为Python2.7.11,Qt5.5.1
资源推荐
资源详情
资源评论
收起资源包目录
PythonQt3.0-win-x86-Qt5.5.1-Python2.7.11-debug-release.zip (45个子文件)
PythonQt3.0
include
PythonQtConversion.h 22KB
PythonQtDoc.h 25KB
PythonQt.h 34KB
PythonQt_QtAll.h 2KB
PythonQtClassInfo.h 11KB
PythonQtVariants.h 2KB
PythonQtMisc.h 5KB
PythonQtBoolResult.h 2KB
PythonQtImportFileInterface.h 3KB
PythonQtClassWrapper.h 3KB
PythonQtQFileImporter.h 2KB
PythonQtSlot.h 4KB
PythonQtSystem.h 2KB
PythonQtCppWrapperFactory.h 3KB
PythonQtStdOut.h 2KB
PythonQtObjectPtr.h 5KB
PythonQtMethodInfo.h 8KB
PythonQtSignal.h 2KB
PythonQtInstanceWrapper.h 5KB
PythonQtSignalReceiver.h 5KB
PythonQtPythonInclude.h 3KB
PythonQtStdDecorators.h 10KB
PythonQtUtils.h 3KB
PythonQtImporter.h 5KB
PythonQtStdIn.h 2KB
lib
PythonQt_QtAll_d.exp 705B
PythonQt.dll 1.27MB
python27.lib 229KB
PythonQt_QtAll_d.pdb 46.71MB
PythonQt_QtAll.exp 701B
PythonQt_QtAll_d.dll 16.56MB
PythonQt_d.exp 108KB
python27.dll 2.59MB
python27_d.dll 4.11MB
PythonQt_QtAll_d.ilk 52.77MB
PythonQt.exp 108KB
PythonQt_d.lib 177KB
PythonQt_d.ilk 10.95MB
python27_d.lib 237KB
PythonQt_QtAll_d.lib 2KB
PythonQt_QtAll.dll 8.53MB
PythonQt.lib 176KB
PythonQt_QtAll.lib 2KB
PythonQt_d.pdb 15.11MB
PythonQt_d.dll 3.24MB
共 45 条
- 1
资源评论
- l_dd2018-01-29还不错...能用
- 骑不快的单车2019-04-17可以使用,谢谢
z182068171
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功