QT编写串口助手 .pro文件中 QT += serialport serial.h: 1 #ifndef SERIAL_H 2 #define SERIAL_H 3 4 #include <QMainWindow> 5 6 /*-------user--------------------*/ 7 //port 8 #include <QSerialPort> 9 //debug10 2021-12-02
The difference between join and detach A C++ thread object generally (but not always) represents a thread of execution, which is an OS or platform concept. When thread::join() is called, the calling thread will block until the thread of ex 2021-12-02
QT文件操作-遍历 QT的路径格式使用 / 或 \ 读写文本 1 //写文本 2 QFile f("F:/src/1.txt"); 3 if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) 4 { 5 qDebug() << "Open failed." << endl; 6 } 7 2021-12-02
备份程序-遍历 #include "fllemanage.h"#include "ui_fllemanage.h"fllemanage::fllemanage(QWidget *parent) : QWidget(parent) , ui(new Ui::fllemanage){ ui->setupUi(this); //copy测试!!!!!!// QFile src("F:/ 2021-12-02
垃圾文件助手 没看程序,白天搞的雕刻机(呕~~) 强行凑每日一篇,上传一个自己写的垃圾文件助手 可以实现目标文件下的文件名搜寻,并进行删除和复制整理到新文件夹(拉吉如我) 博客园竟然还有文件上传限制。。。github链接:https://github.com/qianxunslimg/QFileManage 2021-12-02
Ui文件和Qt代码的关系(转载自大神Mike江) https://blog.csdn.net/tennysonsky/article/details/48030333 如果现有类与新建ui文件的话。除了修改上述地方外,还要修改UI编译产生的头文件, 修改方法参照Widget自动生成的ui_***.h 2021-12-02
Qt Windows.h 后台按键监测 首先 pro: LIBS +=User32.LIBmain.cpp:#include "hooktest.h"#include "ui_hooktest.h"#include <QDebug>LRESULT CALLBACK keyProc(int nCode, WPARAM wParam, LPARAM lParam);HHOOK keyHook=NULL;WPARAM lastke 2021-12-02
windows API关闭exe windows API关闭exe可以直接使用的函数 做个备份 只需要输入要关闭的文件名就好了 #include <Windows.h>#include <Tlhelp32.h>#include <stdio.h>#include <winnt.h> void terminateSuwellReader(const char* str){ HAN 2021-12-02 #开发随笔
c++ 自然排序-window文件排序 起因mfc的fileDialog读取批量文件 读取出来的文件名是按照字典序排序的 例如文件(举例子 忽略后缀):1 2 3 4 5 6 7 8 9 10 11 12 字典序:1 10 11 12 2 3 4 5 6 7 8 9 而很多时候需要按照windows自然排序,也就是例子本身 也就是windows按名称排序的顺序 调整好了一个用的自然排序比较函数 如下 代码//自然排序bool comp 2021-12-02 #开发随笔
最小堆make_heap(), pop_heap()和push_heap() make_heap在容器范围内,就地建堆,保证最大值在所给范围的最前面,其他值的位置不确定 pop_heap将堆顶(所给范围的最前面)元素移动到所给范围的最后,并且将新的最大值置于所给范围的最前面 push_heap当已建堆的容器范围内有新的元素插入末尾后,应当调用push_heap将该元素插入堆中。 1 #include&l 2021-12-02 #leetcode
组合数 防溢出 1 2 long long C(int N, int M) { 3 long long sum = 1; 4 for(int i=1;i<=M; i++) { 5 sum=sum*(N-M+i)/i; 6 } 7 return sum; 8 } 2021-12-02 #leetcode
vector<pair>或者有序map 功能相同 1 static bool sortPair(pair<int, int> a, pair<int, int> b) { 2 return a.second > b.second; 3 } 4 vector<string> findRelativeRanks(vector<int> &score) 2021-12-02 #leetcode