当前位置: 首页 > news >正文

佛山搭建建网站哪家好卖高权重网站做跳转

佛山搭建建网站哪家好,卖高权重网站做跳转,太平洋电脑网站,虚拟主机便宜功能: qt中用多线程的方式调用python脚本,完成C++和python之间的数据交互。为了满足多任务并发的要求,将调用python的逻辑部分封装到QThread的子类PyApiThread中。 主要实现: 包括PyApiThread的实现以及在主线程中如何使用 PyApiThread的的实现,分.h和.cpp两个文件 #ifnd…功能: qt中用多线程的方式调用python脚本,完成C++和python之间的数据交互。为了满足多任务并发的要求,将调用python的逻辑部分封装到QThread的子类PyApiThread中。 主要实现: 包括PyApiThread的实现以及在主线程中如何使用 PyApiThread的的实现,分.h和.cpp两个文件 #ifndef PYAPITHREAD_H #define PYAPITHREAD_H#include "Python.h" #include QMap #include QQueue #include QThread #include QVariantclass QMutex; class Widget; class QEventLoop; class PyApiThread : public QThread {Q_OBJECT public: explicit PyApiThread(Widget* parent = nullptr);~PyApiThread();bool isRunning()const;void setSleepTime(uint ms); Q_INVOKABLE void stopRuning(); Q_INVOKABLE void stopPyApi(const QString pyfile);void addPyApi(const QString pyfile, const QString function,const QStringList paramters, const QVariant attachInfo=""); signals:void stopThreadWork();void startPyApiTask(const QString api);void finishPyApiTask(const QString api, bool cancel);void pyCommandResult(const QVariant result);protected:void run();private:QVariant getPyCmd();QVariant getPyCmdResult();void addPyApiResult(const QVariant result);bool cancelPyApi();void sleepThread(uint ms); void initPythonEnviroement();QVariant parsePyObj(PyObject* obj);QVariant parsePyList(PyObject* obj);QVariant parsePyTuple(PyObject* obj);QVariant parsePyDictionary(PyObject* obj);QVariant parsePySimpleObj(PyObject* obj);const char* printPyApiError(const QString prefix);QVariant executePyScript(const QString pyfile, const QString function,const QStringList paramters, const QVariant attachInfo);bool needExecuteExterProcess(const QString pyfile, const QStringList paramters, QVariantMap result);int executeExterProcess(const QString pyfile, const QStringList paramters);private:uint mSleepTime = 80;bool mRunning = false;//bool mPlatformInit = true;QQueueQVariant mApiQueue; //后面改成无锁队列 QQueueQString mSystemQueue; //后面改成无锁队列QQueueQVariant mApiQueueResult; //后面改成无锁队列QMutex* mMutex = nullptr; QMutex* mSysMutex = nullptr;QEventLoop* mEventLoop = nullptr;Widget* mParent{nullptr};//QMapQString, QVariant(PyApiThread::*)(const QVariantMap) mFuncs; };#endif // PYAPITHREAD_H#include "pyapithread.h" //#include "pyinterface.h" #include "rlog.h" #include "widget.h"#include QDebug #include QMutex #include QTimer #include QWidget #include QDateTime #include QEventLoop #include QtConcurrent #include QCoreApplicationclass PythonThreadLocker {PyGILState_STATE state; public:PythonThreadLocker() : state(PyGILState_Ensure()){}~PythonThreadLocker() {PyGILState_Release(state);} };PyApiThread::PyApiThread(Widget *parent):mParent(parent) { }PyApiThread::~PyApiThread() {if(mMutex){delete mMutex;mMutex = nullptr;}if(mSysMutex){delete mSysMutex;mSysMutex = nullptr;}if(mEventLoop){mEventLoop-quit();delete mEventLoop;mEventLoop = nullptr;}}void PyApiThread::stopRuning() { mRunning = false;mEventLoop-quit();emit stopThreadWork();qDebug()"stopRuning
http://www.zqtcl.cn/news/821480/

相关文章:

  • 网站运营需要服务器吗在哪个网站做图片视频带音乐
  • 大连网站备案高品质网站建设公司
  • 建站模板哪个好网站添加子域名
  • html5创意网站创建网站公司好
  • php网站开发外文旅游电子商务网站的品牌建设
  • 陕西西安网站建设公司哪家好网页框架是什么
  • 广东网站建设效果安福网站建设
  • 如何将html发布到网站微帮网免费发布信息网
  • 做个网站西安专业网络推广公司
  • 建设网站cms网站开发后台需要自己写吗
  • 天津协会网站建设学计算机的做网站的叫什么工作
  • 商城网站建设缺点淘宝店铺怎么免费推广
  • 利于优化的网站模板360建筑网密码忘了
  • 商务网站建设找哪家网页设计商品页面制作
  • 连云港网站建设方案大型门户网站多少钱
  • win7 iis设置网站首页网站建设攵金手指科杰壹陆
  • 阿里巴巴网站建设的功能定位手机在线制作图片加字
  • 网站联系我们的地图怎么做的电子商务网站建设完整案例教程
  • 北京学习网站建设湖北省建设厅政务公开网站
  • 推广做网站联系方式贵州省领导班子名单一览表
  • 厦门的网站建设公司徐州城乡建设局网站
  • 天津圣辉友联网站建设南昌本地生活网站有哪些
  • 境外社交网站上做推广上海网站建设的价格低
  • 山西专业网站建设大全高校网站群建设研究
  • 网络营销网站建设流程网站功能设计指什么
  • 企业网络推广网站琼海市建设局网站
  • 移动网站搭建网页设计页面设计
  • 建设网站进行商品营销的重要性恢复正常百度
  • 美容会所网站模板下载jsp网站开发实现增删改查
  • 注册网站需要注意什么深圳建站公司兴田德润官网多少