自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 ubuntu 安装Qt ChatGPT提供 安装openCV库

在 Ubuntu 上进行 C++ 开发时,可以使用 OpenCV 库进行图像处理和计算机视觉相关的开发。安装 OpenCV 库:可以使用 apt-get 命令从官方仓库中安装 OpenCV 库。然后按照提示进行安装,可以选择安装路径和组件。Ubuntu 下 C++开发openCV。

2023-05-05 17:54:38 808

原创 Qt 链接Access 数据库无法连接驱动程序和应用程序之间的体系结构不匹配 QODBC3: Unable to connect“的错误的解决办法

添加链接描述

2023-04-21 17:28:28 695

原创 写一个string类

【代码】写一个string类。

2023-04-18 16:49:56 92

原创 C++设计模式-单例模式及其应用场景

C++单例模式

2023-04-17 11:06:42 98

原创 Qt Http body请求 类比postman

【代码】Qt Http body请求 类比postman。

2023-04-13 16:00:02 122

原创 epoll 两种工作方式

/如果读一个缓冲区 缓冲区没有数据 如果是带阻塞就阻塞等待 如果 非阻塞 返回值等-1并且将errno 设置为EAGAIN。读数据 只要读缓冲区有数据 就会检测到变化 12个字符 一次读4个 要调用三次poll_wait。//获取cfd的标志位。数据从无到有 数据来了一次epoll只会触发一次 不管有没有读完。12个字符 一次读4个 只会调用一次 但是没读干净。

2023-03-17 12:12:02 353

原创 MQTT C++ windows端 订阅端

MQTT

2023-02-01 16:37:42 462 5

原创 【2022工作记录】C++ 中文字符串乱码问题

【代码】【2022工作记录】C++ 中文字符串乱码问题。

2023-01-12 16:13:24 298

原创 【2022工作】【httplib工作记录】【使用curl Post 上传文件】

【libcurl C++ post 上传文件】

2023-01-12 16:05:54 241

原创 QJson使用

QJsonObject obj; obj.insert("name","Ace"); obj.insert("sex","man"); obj.insert("agr","20"); QJsonObject subobj; subobj.insert("father","Gol_D_Roger"); subobj.insert("mother","ELLien_D_Roger"); subobj.insert("brother","sabo"); .

2022-03-11 16:34:54 599

原创 QString 转Std:string

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入Std:string 转 QStringQTextCodec *tc = QTextCodec::codecForName

2021-06-29 15:03:35 212

原创 Qt 多进程

Qt多进程

2021-03-03 16:17:59 331 1

原创 Qt多进程通信 共享内存

//判断当前的进程是否存在一个共享内存// if(this->memory->isAttached())// {// memory->detach();//如果当前存在共享内存则删除掉// QString fileName=QFileDialog::getOpenFileName(this,“Open Image”,QString(),"Image(.png,.bmp,.jpgh)");// QImage image;//

2021-03-03 16:14:42 262 1

原创 Qt输入框设置背景透明LineEdit TextEdit

QLineEdit *lineEdit=new QLineEdit ;QPalettepl=lineEdit->palette();pl.setBrush(QPalette::Base,QBrush(QColor(255,0,0,0)));lineEdit->setPalette(pl);

2021-01-08 14:56:56 2268

原创 Libevent 事件过滤器

#include "event2/listener.h"#include <error.h>#include <string.h>#include "event.h"#include <arpa/inet.h>#include <stdlib.h>#include <sys/socket.h>#include <event2/bufferevent.h>#include <event2/bufferevent_st

2021-01-02 22:47:37 153

原创 bufferevent客户端发送文件并处理超时和断开事件

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/types.h>#include <sys/wait.h>#include <errno.h>#include <str

2021-01-01 22:32:27 555

原创 Libevent学习笔记 服务器 接受 和相应超时断开链接操作

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/types.h>#include <sys/wait.h>#include <errno.h>#include <st.

2020-12-31 20:08:31 914 1

原创 libevent 读取用户登陆日志文件并监听文件更新

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/types.h>#include <sys/wait.h>#include <errno.h>#include <st.

2020-12-31 11:11:32 167

原创 libevent学习笔记 定时器使用

#include <unistd.h>#include <fcntl.h>#include <stdio.h>#include <error.h>#include <string.h>#include <stdlib.h>#include <signal.h>#include <event.h>#include <event2/event-config.h>#include <

2020-12-31 10:08:53 97

原创 libevent在 Linux 下信号 事件处理 源码学习

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/wait.h>#include <errno.h>#include <string.h>#include <time..

2020-12-30 20:04:25 142

原创 Linux libevent设置网络模型 配置特征

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/wait.h>#include <errno.h>#include <string.h>#include <time..

2020-12-30 14:42:46 160

原创 Linux 开发 静态库制作

静态库 lib库的名字.a动态库 lib库的名字.so源代码.c .cpp .h将.c文件生成.ogcc a.c b.c -c将.o打包ar rcs libtest.a a.o b.onm libtest.a 查看静态库发布使用-L ./include -ltest -o app(生成的名字)-I(大写的i)指定头文件的路径...

2020-12-29 09:26:47 78

原创 Qt 画圆形进度条 工作例子

void CKMMain_Set_System_Page::paintEvent(QPaintEvent *){ QPainter p(this); p.setRenderHint(QPainter::Antialiasing); double percent = (iremain * 1.0f) / itotal; int m_rotateAngle = 360*iremain/itotal; int side = qMin(width(), height())

2020-12-28 17:26:59 246

原创 libevent 学习笔记

#include "event2/listener.h"#include <error.h>#include <string.h>#include <arpa/inet.h>#include <stdlib.h>#include <sys/socket.h>//回调函数 void listencallback(struct evconnlistener *a1, evutil_socket_t fd, struct sockaddr

2020-12-27 10:18:12 1000 4

原创 epoll 网络模型 学习代码

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/wait.h>#include <errno.h>#include <string.h>#include <time.h

2020-12-24 17:49:37 163 1

原创 Select 网络模型

maxfd 最大描述符加1fd_set操作集合 #include <sys/select.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>int select(int maxfdp, fd_set *readset, fd_set *writeset, fd_set *exceptset,struct timeval *timeout);maxfdp:被监听的文件描

2020-12-24 16:03:50 208

原创 UDP 通信例程

#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include <ctype.h>#include <strings.h>#include <sys/wait.h>#include <errno.h>#include <string.h>#include <time.h

2020-12-23 14:52:57 305

原创 2020-12-23

多进程并发服务器

2020-12-23 00:32:43 85

原创 Linux 开发 进程间通信 消息队列学习笔记

#include "sys/types.h"#include <signal.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <sys/msg.h>#include <string.h>struct msgbuf{ long

2020-12-22 13:59:06 71

原创 共享内存 进程间通信

kill SIGKILLraise 向自己的进程发送函数SIGALRM 不是立马发送 是定时等待发出 定时一段时间才发信号 只能发送给当前进程 和raise 一样uint alarm(uint second)没有告诉内核发送什么信号 让内核延迟second 的时间再发送发送给当前进程 在信号接受前进程不能结束 收到信号终止进程信号的接收sleeppause 当前进程处于睡眠状态ctrl +Z SIGTSTPctrl +c 键盘驱动来发送 SIGINT 信号在用用户输入 字符Ctrl+c

2020-12-21 20:56:54 180

原创 无名管道

```cpp#include "unistd.h"#include "stdio.h"#include "stdlib.h"int main(){ int ret; int fd[2]; char buf[]="hello linux\n"; char readbuf[128]={0}; ret=pipe(fd); if(ret<0) { printf("create pipe failure."); .

2020-12-21 08:39:37 71

原创 Qt 正则表达式 限制输入字符不重复

派生QValidate 重写虚函数QValidator::State CKMValidator::validate ( QString & input, int & pos ) const{ if(input.isEmpty()) return QValidator::Acceptable; QChar chLast = input.at(pos - 1); int count = input.count(chLast); if(count >= 2

2020-12-18 14:07:56 302

原创 Qt

Qt 信号槽 和 回调函数的区别回调函数的本质是“你想让别人的代码执行你的代码,而别人的代码你又不能动”这种需求下产生的。回调函数是函数指针的一种用法,如果多个类都关注某个类的状态变化,此时需要维护一个列表,以存放多个回调函数的地址。对于每一个被关注的类,都需要做类似的工作,因此这种做法效率低,不灵活。Qt信号与槽机制降低了Qt对象的耦合度。信号槽 信号发送者不需要知道信号接收者的信息类型安全 相关联的信号槽参数必须匹配才可以 任意类型 任意参数QT:1:QT信号槽机制的优缺点 :1)QT

2020-12-17 08:50:54 195

原创 QPainter

QPainter painter(this); QPen pen(QColor(255,0,0)); pen.setWidth(5); pen.setStyle(Qt::DotLine); //笔风格 painter.setPen(pen); QBrush brush(Qt::cyan); painter.setBrush(brush); //画线 painter.drawLine(QPoint(0,0),QPoint(50,50));.

2020-12-16 16:07:33 237

原创 C++单例模式

class Singleton{public:~Singleton(){qDebug()<<"~Singleton";}Singleton (const Singleton&)=delete;static Singleton &get_instance(){static Singleton instance;return instance;}private :Singleton (){qDebug()<<“Singleton”;}};

2020-12-15 08:36:37 66

原创 C++题目

STL 排序#include <iostream>#include <algorithm>//STL库函数using namespace std;int main(){ int arrays[100]; int n; cin >> n; for (int i = 1;i <= n;i ++) { cin >> arrays[i]; } sort(arrays,arrays

2020-12-12 20:30:56 254

原创 如何定义一个只能在堆(栈)上创建对象的类

只能在栈上创建 不能newWidget *w=new Widget;出错class Widget : public QWidget{ Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); private: Ui::Widget *ui; void* operator new(size_t){} void operator delete(void*){}

2020-11-27 15:06:31 82

原创 QTextEdit 限制最大输入

void CKMAddformatdialog::on_textEdit_format_content_textChanged(){ QString textContent = ui->textEdit_format_content->toPlainText(); int length = textContent.count(); int maxLength = MAXLEN; // 最大字符数 if(length > ma.

2020-11-10 10:45:29 708

原创 mmap 进程间通信及常见问题

#include <stdlib.h>#include <unistd.h>#include <string.h>#include <stdio.h>#include <fcntl.h>#include <sys/mman.h>int main(void){pid_t pid;char *p=NULL;int fd=open("mytest.txt",O_CREAT|O_RDWR,0644);if(fd<0)

2020-11-04 11:06:42 178

原创 pipe.c 父子进程通信

#include <stdlib.h>#include <unistd.h>#include <string.h>#include <stdio.h>int main(void){int fd[2];pid_t pid;int ret=pipe(fd);if(ret==-1){perror(“pipe error\n”);exit(1);}pid=fork();if(pid==-1){perror(“fork error\n”

2020-11-04 11:05:56 521

VS2019 MQTT C

VS2019 MQTT C

2023-02-01

VS2019 MQTT CPP

VS2019 MQTT CPP

2023-02-01

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除