上一页 1 2 3 4 5 6 7 ··· 56 下一页
摘要: 会存在进入 QOpenGLWidget 页面时候,有些电脑没有问题,有些电脑软件闪退了。可能的原因: 电脑缺少 OpenGL 支持: 如果目标电脑的显卡驱动不支持 OpenGL,或者 OpenGL 版本过低,可能会导致程序崩溃。 解决办法: 直接用 Qt 的 painter 绘图(继承QWidget 阅读全文
posted @ 2025-03-27 09:29 double64 阅读(253) 评论(0) 推荐(0)
摘要: if (int a = 0) { cout << a << endl; } else { cout << a + 1<< endl;// 可以访问到 a } 上面输出 1. 阅读全文
posted @ 2025-03-22 21:30 double64 阅读(25) 评论(0) 推荐(0)
摘要: 控件本身和作用它的布局都设置下这个属性,应该就可以解决控件颜色不一致的问题了吧。 阅读全文
posted @ 2025-03-21 12:43 double64 阅读(24) 评论(0) 推荐(0)
摘要: 使用 Lambda 表达式捕获按钮对象 通过 Lambda 表达式连接信号和槽时,可以直接捕获按钮对象。 #include <QApplication> #include <QPushButton> #include <QDebug> class MyWidget : public QWidget 阅读全文
posted @ 2025-03-20 17:12 double64 阅读(61) 评论(0) 推荐(0)
摘要: // 辅助函数:计算 10 的幂 constexpr int pow10(int n) { return n == 0 ? 1 : 10 * pow10(n - 1); } template <int... Num> struct NumCat; template <int First, int.. 阅读全文
posted @ 2025-03-17 23:21 double64 阅读(43) 评论(0) 推荐(0)
摘要: 传递自定义类型 如果需要传递自定义类型,必须先注册该类型。 #include <QApplication> #include <QPushButton> #include <QDebug> #include <thread> #include <chrono> // 自定义类型 struct Cus 阅读全文
posted @ 2025-03-16 21:56 double64 阅读(413) 评论(0) 推荐(0)
摘要: 一 . using class A { public: void Hello() { cout << "hello" << endl; } void Hi() { cout << "Hi" << endl; } }; class B :public A { private: using A::Hi; 阅读全文
posted @ 2025-03-15 23:08 double64 阅读(36) 评论(0) 推荐(0)
摘要: ui->lbl_cupInfo->setText("hello,good,morning,jksfsafsflkasjflksajfsjf"); ui->lbl_cupInfo->adjustSize(); 阅读全文
posted @ 2025-03-01 10:12 double64 阅读(27) 评论(0) 推荐(0)
摘要: class A { public: virtual ~A() {} int a{ 100 }; int b{ 200 }; }; class B :public A { public: B() = default; B(const B&b) //:A(b) // OK, 委托构造函数形式 { A:: 阅读全文
posted @ 2025-02-27 19:22 double64 阅读(23) 评论(0) 推荐(0)
摘要: std::vector<int> arr = {0,1,2,3,4,5 }; auto it = std::find(arr.begin(), arr.end(), 3); auto index = it - arr.begin(); std::cout << "[" << index << "]" 阅读全文
posted @ 2025-02-15 11:09 double64 阅读(160) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 56 下一页