08 2022 档案

摘要:Code::Blocks Dev-C++ clion C-Free 阅读全文
posted @ 2022-08-25 19:34 thomas_blog 阅读(32) 评论(0) 推荐(0)
摘要:至少有一个纯虚函数 不能生成对象 模拟方法 构造和拷贝构造都使用protected修饰 析构函数设置为纯虚函数 析构函数使用protected修饰 阅读全文
posted @ 2022-08-25 13:31 thomas_blog 阅读(29) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; void func(int a) { if(a == 0) { throw string("a is error"); throw a; } } int main() { try { func(0); } catch( 阅读全文
posted @ 2022-08-19 08:41 thomas_blog 阅读(20) 评论(0) 推荐(0)
摘要:#include <iostream> //#define NDEBUG //发行版本中,assert都会被关掉 #include <assert.h> int main() { int i = 10; assert(i > 20); return 0; } a.out: assert.cpp:7: 阅读全文
posted @ 2022-08-18 19:41 thomas_blog 阅读(71) 评论(0) 推荐(0)
摘要:#include <iostream> #include <typeinfo> int main() { int i; const std::type_info &info = typeid(int); std::cout << "typeid " << info.name() << std::en 阅读全文
posted @ 2022-08-17 08:40 thomas_blog 阅读(41) 评论(0) 推荐(0)
摘要:#include <iostream> class Base { public: Base() { func(); } ~Base() { func(); } virtual void func() { std::cout << "Base func" << std::endl; } }; clas 阅读全文
posted @ 2022-08-17 07:48 thomas_blog 阅读(31) 评论(0) 推荐(0)
摘要:#include <iostream> #include <thread> #include <mutex> std::timed_mutex mutex; void mythread() { std::chrono::milliseconds timeout(100); //100ms std:: 阅读全文
posted @ 2022-08-13 13:16 thomas_blog 阅读(87) 评论(0) 推荐(0)
摘要:原子操作指“不可分割的操作”,一般针对一个变量 互斥量一般针对代码段 #include <iostream> #include <thread> #include <atomic> std::atomic<int> atomic; void add() { for(int i = 0; i < 10 阅读全文
posted @ 2022-08-11 19:17 thomas_blog 阅读(346) 评论(0) 推荐(0)
摘要:#include <iostream> #include <future> int mythread() { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::chrono::milliseconds 阅读全文
posted @ 2022-08-08 19:12 thomas_blog 阅读(113) 评论(0) 推荐(0)
摘要:#include <iostream> #include <future> int mythread() { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::chrono::milliseconds 阅读全文
posted @ 2022-08-08 18:47 thomas_blog 阅读(670) 评论(0) 推荐(0)
摘要:#include <iostream> #include <future> void mythread(std::promise<int> &promise, int arg) { std::cout << "mythread " << std::this_thread::get_id() << s 阅读全文
posted @ 2022-08-08 16:25 thomas_blog 阅读(278) 评论(0) 推荐(0)
摘要:#include <iostream> #include <future> int mythread(int arg) { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::cout << "arg " 阅读全文
posted @ 2022-08-08 15:41 thomas_blog 阅读(54) 评论(0) 推荐(0)
摘要:#include <iostream> #include <future> int mythread() { std::cout << "mythread " << std::this_thread::get_id() << std::endl; std::chrono::milliseconds 阅读全文
posted @ 2022-08-08 14:55 thomas_blog 阅读(123) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> #include <condition_variable> std::mutex mutex; std::condition_variable cond; void in_msg() { w 阅读全文
posted @ 2022-08-07 22:12 thomas_blog 阅读(52) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> using namespace std; class MyInstance { MyInstance(){} public: static MyInstance *getInstance() { std::call_once( 阅读全文
posted @ 2022-08-07 15:46 thomas_blog 阅读(182) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; class MyInstance { MyInstance(){} public: static MyInstance *getInstance() { if(m_instance == NULL) { m_insta 阅读全文
posted @ 2022-08-07 15:11 thomas_blog 阅读(34) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { std::unique_lock<std::mutex> unique(mutex); std: 阅读全文
posted @ 2022-08-07 13:26 thomas_blog 阅读(103) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { std::unique_lock<std::mutex> unique(mutex, std:: 阅读全文
posted @ 2022-08-07 13:19 thomas_blog 阅读(107) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { std::unique_lock<std::mutex> unique(mutex, std:: 阅读全文
posted @ 2022-08-07 13:08 thomas_blog 阅读(116) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { mutex.lock(); std::unique_lock<std::mutex> uniqu 阅读全文
posted @ 2022-08-07 12:47 thomas_blog 阅读(134) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { std::unique_lock<std::mutex> unique(mutex); std: 阅读全文
posted @ 2022-08-07 12:37 thomas_blog 阅读(48) 评论(0) 推荐(0)
摘要:#include <iostream> #include <mutex> #include <thread> void msg_func() { std::mutex mutex; while(1) { std::lock_guard<std::mutex> guard(mutex); std::c 阅读全文
posted @ 2022-08-07 12:08 thomas_blog 阅读(82) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QPicture> #include <QPainter> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widg 阅读全文
posted @ 2022-08-05 15:08 thomas_blog 阅读(70) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QPainter> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(th 阅读全文
posted @ 2022-08-05 13:28 thomas_blog 阅读(60) 评论(0) 推荐(0)
摘要:Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); /* 绘图设备 专门为平台做了显示的优化 */ QPixmap pixmap(300, 300); pixmap.f 阅读全文
posted @ 2022-08-04 22:24 thomas_blog 阅读(106) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QDebug> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this 阅读全文
posted @ 2022-08-04 17:26 thomas_blog 阅读(138) 评论(0) 推荐(0)
摘要:void paintEvent(QPaintEvent *event) override { QPainter painter(this); painter.drawEllipse(QPoint(100, 100), 50, 50); /* 移动画家 */ painter.translate(QPo 阅读全文
posted @ 2022-08-04 17:05 thomas_blog 阅读(104) 评论(0) 推荐(0)
摘要:void paintEvent(QPaintEvent *event) override { QPainter painter(this); painter.drawEllipse(QPoint(100, 100), 50, 50); //设置抗锯齿 效率较低 painter.setRenderHi 阅读全文
posted @ 2022-08-04 16:59 thomas_blog 阅读(783) 评论(0) 推荐(0)
摘要:#ifndef WIDGET_H #define WIDGET_H #include <QWidget> #include <QPainter> QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACE class Widg 阅读全文
posted @ 2022-08-04 08:19 thomas_blog 阅读(346) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); /* 安装事件过滤器 */ u 阅读全文
posted @ 2022-08-03 23:41 thomas_blog 阅读(62) 评论(0) 推荐(0)
摘要:#ifndef MYLABEL_H #define MYLABEL_H #include <QWidget> #include <QDebug> #include <QMouseEvent> #include <QEvent> #include <QLabel> namespace Ui { cla 阅读全文
posted @ 2022-08-03 22:32 thomas_blog 阅读(72) 评论(0) 推荐(0)
摘要:#ifndef MYLABEL_H #define MYLABEL_H #include <QWidget> #include <QDebug> #include <QMouseEvent> #include <QLabel> namespace Ui { class MyLabel; } clas 阅读全文
posted @ 2022-08-03 22:03 thomas_blog 阅读(150) 评论(0) 推荐(0)
摘要:#ifndef MYBUTTON_H #define MYBUTTON_H #include <QWidget> #include <QDebug> #include <QPushButton> namespace Ui { class MyButton; } class MyButton : pu 阅读全文
posted @ 2022-08-03 21:30 thomas_blog 阅读(44) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QMovie> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this 阅读全文
posted @ 2022-08-03 14:34 thomas_blog 阅读(207) 评论(0) 推荐(0)
摘要:![](https://img2022.cnblogs.com/blog/1747317/202208/1747317-20220803140022646-1342714597.png) ![](https://img2022.cnblogs.com/blog/1747317/202208/1747317-20220803140035735-680190620.png) 阅读全文
posted @ 2022-08-03 14:01 thomas_blog 阅读(15) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QDebug> #include <QDialog> #include "mywidget.h" Widget::Widget(QWidget *parent) : QWidget(parent 阅读全文
posted @ 2022-08-03 08:16 thomas_blog 阅读(29) 评论(0) 推荐(0)
摘要:#include "mainwindow.h" #include "ui_mainwindow.h" #include <QDockWidget> #include <QTextEdit> MainWindow::MainWindow(QWidget *parent) : QMainWindow(p 阅读全文
posted @ 2022-08-02 23:10 thomas_blog 阅读(173) 评论(0) 推荐(0)
摘要:#ifndef WIDGET_H #define WIDGET_H #include <QWidget> QT_BEGIN_NAMESPACE namespace Ui { class Widget; } QT_END_NAMESPACE class Widget : public QWidget 阅读全文
posted @ 2022-08-01 22:06 thomas_blog 阅读(34) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include <QDebug> Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this 阅读全文
posted @ 2022-08-01 20:46 thomas_blog 阅读(96) 评论(0) 推荐(0)
摘要:#include "widget.h" #include "ui_widget.h" #include "mypushbutton.h" Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setu 阅读全文
posted @ 2022-08-01 18:52 thomas_blog 阅读(32) 评论(0) 推荐(0)