上一页 1 2 3 4 5 6 ··· 10 下一页
  2021年9月23日
摘要: 1、在与qml通信的时候,需要把函数接口暴露给qml需要在函数前面加入Q_INVOKABLE关键字,且需要注意成员函数的公有或私有类型。 例如: .h文件 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespa 阅读全文
posted @ 2021-09-23 11:25 缘随风烬 阅读(1865) 评论(0) 推荐(0) 编辑
  2021年9月17日
摘要: 串口的实现。 1、在.pro文件内加入 QT += serialport 2、.h文件 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QSerialPort> #include <QSerialP 阅读全文
posted @ 2021-09-17 16:08 缘随风烬 阅读(375) 评论(0) 推荐(0) 编辑
  2021年9月14日
摘要: 一、方法一 #include <QCoreApplication> #include <QMutex> #include <QFile> #include <QDateTime> #include <QTextStream> #include <loghandle.h> #include <QDeb 阅读全文
posted @ 2021-09-14 16:57 缘随风烬 阅读(330) 评论(0) 推荐(0) 编辑
  2021年9月3日
摘要: 1、QString转Json QString str = "{\"key\", \"value\"}"; QJsonDocument document = QJsonDocument::fromJson(str.toLocal8Bit().data());QJsonObject jsonObject 阅读全文
posted @ 2021-09-03 11:51 缘随风烬 阅读(222) 评论(0) 推荐(0) 编辑
  2021年9月2日
摘要: #define PI 3.14double ThreadToParseJson::getAngle(double lat_a, double lng_a, double lat_b, double lng_b) //lat_a表示上个点纬度, lat_b表示当前点的纬度 { double lat1 阅读全文
posted @ 2021-09-02 16:44 缘随风烬 阅读(580) 评论(0) 推荐(0) 编辑
  2021年8月26日
摘要: // 替换字符串的某一字符 std::string& replace_all(std::string& str, const std::string& old_value, const std::string& new_value) { while (true) { std::string::siz 阅读全文
posted @ 2021-08-26 15:45 缘随风烬 阅读(1205) 评论(0) 推荐(0) 编辑
摘要: // 清空字符串所有空格 std::string& ClearAllSpace(std::string &str) { int index = 0; if (!str.empty()) { while ((index = str.find(' ', index)) != std::string::n 阅读全文
posted @ 2021-08-26 15:42 缘随风烬 阅读(1342) 评论(0) 推荐(0) 编辑
摘要: std::vector<std::string> split(std::string str, std::string pattern) { std::string::size_type pos; std::vector<std::string> result; str += pattern;//扩 阅读全文
posted @ 2021-08-26 15:40 缘随风烬 阅读(157) 评论(0) 推荐(0) 编辑
摘要: class UDP { public: UDP() { RecvAddrSize = sizeof(RecvAddr); int nResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (nResult != NO_ERROR) { std::cout 阅读全文
posted @ 2021-08-26 15:39 缘随风烬 阅读(2919) 评论(0) 推荐(0) 编辑
摘要: 1、建立一个新的类,且需要继承QObject和QRunnable Class MyThreadPool : public QObject, public QRunnable{ }; 注意在继承的时候,一定是QObject在前,QRunnable在后,不然会报错。 2、声明各个函数。 class My 阅读全文
posted @ 2021-08-26 14:53 缘随风烬 阅读(348) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 10 下一页