测试Demo
知途。。。
这个作者很懒,什么都没留下…
展开
-
Qt编译Assimp
learn opengl qt原创 2022-03-10 16:15:13 · 487 阅读 · 0 评论 -
SOCKET 简单实现同步服务器
#ifndef SERVER_H #define SERVER_H #include <QObject> #include <list> #include <winsock2.h> class server : public QObject { Q_OBJECT public: explicit server(QObject *parent = nullptr); virtual ~server(); SOCKET m_server;原创 2021-02-03 14:37:18 · 252 阅读 · 0 评论 -
QWaitCondition使用小结
#include <QCoreApplication> #include <thread> #include <QWaitCondition> #include <iostream> #include <QThread> #include <QMutex> #include <queue> using namespace std; QMutex mutex1; QWaitCondition condition; int t原创 2021-01-15 15:50:00 · 459 阅读 · 0 评论 -
线程同步QSemaphore
QSemaphore类提供了强壮的整数信号量。 QSemaphore也可以被用来使线程的执行顺序化,和QMutex的方法相似。信号量和互斥量的不同在于,信号量可以在同一时间被多于一个的线程访问。 /* *一个生产者 多个消费者情况,,使用 QSemaphore线程同步 * */ #include <QCoreApplication> #include <thread> #include <QSemaphore> #include <iostream> #in原创 2021-01-15 14:16:11 · 180 阅读 · 0 评论 -
win系统下共享内存通信示例
#include "mainwindow.h" #include <QApplication> #include <thread> #include <iostream> #include <windows.h> #include <mutex> using namespace std; typedef struct { int head; int length; char data[1024] = {0}; }pack原创 2021-01-05 14:28:25 · 140 阅读 · 0 评论 -
winSocket客户端简单示例
#ifndef SOCKETCLIENT_H #define SOCKETCLIENT_H #include <QObject> #include <winsock2.h> #include <queue> using namespace std; class socketClient : public QObject { Q_OBJECT public: explicit socketClient(QObject *parent = nullptr);原创 2021-01-04 14:17:59 · 238 阅读 · 0 评论 -
c++类的静态函数访问成员方法
在类的静态函数中调用类的成员方法或变量时会报错,此时可以使用如下方法 class A() { public: void setA(const int &a); static test(); private: int m_a; static A* pThis; } A* A::pThis = nullptr; A::A() { pThis = this; } void A::setA(const int &a) { m_a = a; } void A::test() { int原创 2020-12-29 15:23:57 · 3097 阅读 · 0 评论 -
Qt日志(log)系统
在release下将异常打印到文件中 void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg) { static QMutex mutex; mutex.lock(); QString text; switch(type) { // case QtDebugMsg: // text = QString("Debu原创 2020-07-27 13:10:21 · 977 阅读 · 0 评论 -
Qt调用python
#include #include <math.h> #include <Python.h> using namespace std; /* 注意: error: ‘::hypot’ has not been declared 注意将math.h引用在Python.h之前可解决以上问题 python文件需要放在和.exe同级目录下面,否则将会调用失败 使用如下方式将.py文件封装为.pyc文件 1.cmd定位到.py所在目录 2.在cmd中使用命令 python -原创 2020-07-21 16:02:16 · 392 阅读 · 0 评论