随笔分类 - C/C++
摘要:遇到个需要将两个std::tuple对应元素分别求平均值的需求 实现 #include <iostream> #include <tuple> template <typename T, size_t S = 0, size_t E = std::tuple_size<T>::value> void
阅读全文
摘要:uchar *bits = nullptr; void initBuff(size_t size) { if (bits == nullptr) { bits = new uchar[size]; } } void releaseBuff() { if (bits != nullptr) { del
阅读全文
摘要:https://blog.csdn.net/qq_44575789/article/details/127935697像素处理太慢,这里换种方式 #pragma once #include <QDebug> #include <QImage> #include <QTimer> #include <
阅读全文
摘要:创建并获取窗口句柄 view->show(); view->createWinId(); auto wid = view->winId(); 获取图片 // 三秒钟之后 QTimer::singleShot(3000, [wid]() { auto&& image = GetGDIBitmap((H
阅读全文
摘要:代码示例 https://download.csdn.net/download/qq_44575789/86993010 CToolBar类 实现 加载位图的成员变量 CToolBar m_ToolBar; CBitmap m_bitmapEmpty; CBitmap m_bitmap1; CBit
阅读全文
摘要:解决方法 将单例对象初始化放入.cpp文件 示例 Fun.h #ifdef FUN_EXPORTS #define FUN_API __declspec(dllexport) #else #define FUN_API __declspec(dllimport) #endif #include <i
阅读全文
摘要:核心部分 识别文本编码,这里使用ICU 核心代码 /// <summary> /// 读取文本文件内容并返回QString /// </summary> /// <param name="path">文件路径</param> /// <returns>文本内容</returns> static QS
阅读全文
摘要:示例代码 #include <string> #include <iostream> // 导入format #include <format> struct Vector4D { int x, y, z, s; }; // std::formatter格式化Vector4D namespace s
阅读全文
摘要:效果 头文件GrayVirsual.h #pragma once #include <QtWidgets/QMainWindow> #include <QVTKOpenGLNativeWidget.h> #include <opencv2/core/core.hpp> #include <openc
阅读全文
摘要:效果 子窗口头文件ViewWidget3D.h #pragma once #include <QMainWindow> #include <QVTKOpenGLNativeWidget.h> #include <vtkActor.h> #include <vtkCamera.h> #include
阅读全文
摘要:子程序主要代码 #include "ChildWidgets.h" #include <QtWidgets/QApplication> #include <QWindow> #include <iostream> #include <QMessageBox> #include <thread> in
阅读全文
摘要:主要参考 https://blog.csdn.net/qq_37996632/article/details/106415402 https://kitware.github.io/vtk-examples/site/Cxx/Qt/BorderWidgetQt 主要代码 #include "Bord
阅读全文
摘要:1. 创建C#类库项目 2. 设置项目属性 3. 添加接口以及类源代码 using System; using System.Runtime.InteropServices; namespace AddCom { [Guid("8F5710FD-528A-4474-A673-47717F93EA88
阅读全文
摘要:官方示例 https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_example.cpp 生产者 #include <iostream> #include <string> #include <cstdlib> #inc
阅读全文
摘要:关键代码 #include "mainwindow.h" #include "ui_mainwindow.h" #include <QToolBar> #include <QMessageBox> class QMenuBar; class QToolBar; MainWindow::MainWin
阅读全文
摘要:原文 头文件定义 #pragma once #include "framework.h" #include <map> #include <tuple> class CScaleWnd : public CDialogEx { public: // 标准构造函数 CScaleWnd(); CScal
阅读全文
摘要:原文 实现与测试 #include <vector> #include <string_view> #include <iostream> using namespace std; std::vector<std::string_view> Split(std::string_view sv, ch
阅读全文
摘要:原文 实现XDLine.hpp #pragma once #include <vector> #include <tuple> #include <algorithm> #include <cmath> namespace DDMath { /** * @brief 最小二乘法,根据三维坐标拟合出一
阅读全文
摘要:首发 一个简单的OpenGL显示十字坐标系小示例 源码地址:https://github.com/WindSnowLi/XDAxis 主要函数声明 #pragma once #include "QExpandOpenGLWidget.h" class XDAxis : public QExpandO
阅读全文
摘要:又有了新思路,复用线程 ThreadPool.hpp #pragma once #include <thread> #include <memory> #include <functional> #include <utility> #include <condition_variable> #in
阅读全文