摘要:
Github 地址为:https://github.com/nothings/stb 重点关注如下三个头文件: stb_image.h // 用于图像加载 stb_image_write.h // 用于写入图像文件 stb_image_resize.h // 用于改变图像尺寸 阅读全文
摘要:
.h #pragma once #include "QImage" #include "Halcon.h" #include "halconcpp/HalconCpp.h" #include "halconcpp/HDevThread.h" /** * @brief QImage2HImage 将 阅读全文
摘要:
看错误提示就大概明白,是国内无法连接到 golang.org 尝试下载了镜像网站 github.com/golang 里面的 tools 也不靠谱 因为安装时总会缺少非常多的插件,导致无法简单地执行 go install golang.org/x/tools/gopls@latest 最终解决方案是 阅读全文
摘要:
std::condition_variable 条件变量等待延时。 std::unique_lock<std::mutex> lock(m_mtx); if (m_cond.wait_for(lock, std::chrono::milliseconds(10)) == std::cv_status 阅读全文
摘要:
会存在进入 QOpenGLWidget 页面时候,有些电脑没有问题,有些电脑软件闪退了。可能的原因: 电脑缺少 OpenGL 支持: 如果目标电脑的显卡驱动不支持 OpenGL,或者 OpenGL 版本过低,可能会导致程序崩溃。 解决办法: 直接用 Qt 的 painter 绘图(继承QWidget 阅读全文
摘要:
if (int a = 0) { cout << a << endl; } else { cout << a + 1<< endl;// 可以访问到 a } 上面输出 1. 阅读全文
摘要:
控件本身和作用它的布局都设置下这个属性,应该就可以解决控件颜色不一致的问题了吧。 阅读全文
摘要:
使用 Lambda 表达式捕获按钮对象 通过 Lambda 表达式连接信号和槽时,可以直接捕获按钮对象。 #include <QApplication> #include <QPushButton> #include <QDebug> class MyWidget : public QWidget 阅读全文
摘要:
// 辅助函数:计算 10 的幂 constexpr int pow10(int n) { return n == 0 ? 1 : 10 * pow10(n - 1); } template <int... Num> struct NumCat; template <int First, int.. 阅读全文
摘要:
传递自定义类型 如果需要传递自定义类型,必须先注册该类型。 #include <QApplication> #include <QPushButton> #include <QDebug> #include <thread> #include <chrono> // 自定义类型 struct Cus 阅读全文