随笔分类 -  Qt

摘要:背景: 现在公司项目需要做一个检测更新的功能,通过访问后台接口,判断是否需要更新。 后台接口是 https 协议的,接口需要post请求,需要带参数,来判断是哪个软件需要做检测更新的操作。 客户端软件使用Qt写的 重点 & 注意事项: 1.https协议,需要用到 ssl,如果跑起来报错,基本都是 阅读全文
posted @ 2022-10-24 14:50 十一的杂文录 阅读(1127) 评论(0) 推荐(0) 编辑
摘要:.h 文件 #pragma once #include <QtWidgets/QWidget> #include "ui_xuexi.h" #include "QMouseEvent" #include "QKeyEvent" #include "QPainter" class xuexi : pu 阅读全文
posted @ 2021-11-04 23:23 十一的杂文录 阅读(883) 评论(0) 推荐(1) 编辑
摘要:在一的基础上改造: .h 文件 #pragma once #include <QtWidgets/QWidget> #include "ui_xuexi.h" #include "QMouseEvent" #include "QKeyEvent" #include "QPainter" #inclu 阅读全文
posted @ 2021-11-04 23:02 十一的杂文录 阅读(429) 评论(0) 推荐(0) 编辑
摘要:新建一个Qt项目,在 .h 文件中写入 #pragma once #include <QtWidgets/QWidget> #include "ui_xuexi.h" #include "QMouseEvent" #include "QKeyEvent" #include "QPainter" cl 阅读全文
posted @ 2021-11-04 22:56 十一的杂文录 阅读(324) 评论(0) 推荐(0) 编辑
摘要:Qt 设置软件窗口图标有三种方式: 一、通过资源文件,设置图标 this->setWindowIcon(QIcon(":/logo.ico")); 二、通过 pro 文件,设置图标 # Windows RC_ICONS = myico.ico # Mac ICON = myico.icns 三、使用 阅读全文
posted @ 2021-10-22 15:49 十一的杂文录 阅读(7251) 评论(0) 推荐(0) 编辑
摘要:#include "QtWidgetsApplication1.h" #include <QtWidgets/QApplication> #include <QtDebug> #include <QFile> #include <QTextStream> #include <QDateTime> # 阅读全文
posted @ 2021-10-18 22:05 十一的杂文录 阅读(1452) 评论(0) 推荐(1) 编辑
摘要:char* 转 BSTR char* s1 = "zhangsan"; CString s2 = CString(s1); BSTR s3 = s2.AllocSysString(); char* 转 LPCWSTR char* a = "a.jpg"; WCHAR b[256]; memset(b 阅读全文
posted @ 2021-09-04 23:11 十一的杂文录 阅读(394) 评论(0) 推荐(0) 编辑
摘要:常规QString拼接字符串我们是这样写的 QString s = QString("My name is %1, age %2").arg("zhangsan").arg("18"); qDebug() << s; // "My name is zhangsan,age 18" Python的fo 阅读全文
posted @ 2021-09-01 23:39 十一的杂文录 阅读(402) 评论(0) 推荐(0) 编辑
摘要:一、拼接字符串 拼接字符串有两种方法: += 、 append QString s; s = "hello"; s = s + " "; s += "world"; qDebug() << s; // "hello world" QString s1 = "hello" ; QString s2 = 阅读全文
posted @ 2021-09-01 23:22 十一的杂文录 阅读(1025) 评论(0) 推荐(0) 编辑
摘要:使用浏览器打开网址 #include <QDesktopServices> #include <QUrl> QUrl url(QString("https://cn.bing.com")); QDesktopServices::openUrl(url); 打开本地文件夹 #include <QDes 阅读全文
posted @ 2021-08-24 22:00 十一的杂文录 阅读(542) 评论(0) 推荐(0) 编辑
摘要:一、对整形排序 // qSort 对整形排序 QList<int> list; list << 1 << 3 << 19 << 0 << 2; qSort(list.begin(), list.end()); foreach(int i, list) { qDebug() << i; } 二、对字符 阅读全文
posted @ 2021-08-24 18:05 十一的杂文录 阅读(1820) 评论(0) 推荐(0) 编辑
摘要:#include <QTime> #include <QDebug> // 根据时间产生随机数 QTime time; time = QTime::currentTime(); qsrand(time.msec() + time.second() * 1000); // 随机数范围 1000 qDe 阅读全文
posted @ 2021-08-21 21:24 十一的杂文录 阅读(592) 评论(0) 推荐(0) 编辑
摘要:*: Win32 网络连接 dll 文件名叫:wininet.dll,位置在 C:\WINDOWS\system32 目录下,将 其拷贝到项目工程下。 #include <QLibrary> #include <QLabel> #define INTERNET_CONNECTION_MODEM 1 阅读全文
posted @ 2021-08-19 23:48 十一的杂文录 阅读(382) 评论(0) 推荐(0) 编辑
摘要:代码讲解: 1.检查数据库文件是否存在,如果不存在就创建数据库文件 2.创建 person 表(等下的操作就是操作这个表) 3.查询出 person 表中所有的数据,并显示出来 Pro 文件 添加 SQL QT += sql .h 头文件 #include <QtSql/QSqlDatabase> 阅读全文
posted @ 2021-08-19 23:29 十一的杂文录 阅读(894) 评论(0) 推荐(0) 编辑
摘要:一、写入注册表 #include <QSettings> //实例 QSettings //参数 1:注册表位置 //参数 2:操作 windows 注册表 QSettings::NativeFormat //说明:QSettings::IniFormat 读写 ini 格式的配置文件,前面用过。 阅读全文
posted @ 2021-08-19 23:07 十一的杂文录 阅读(2203) 评论(0) 推荐(0) 编辑
摘要:操作文件,无非就是读与写,以下为Qt读写ini文件的代码。 demo: #include "widget.h" #include <QApplication> #include <QDebug> #include <QSettings> /*QSettings * // 方法一:可以设置ini文件保 阅读全文
posted @ 2021-08-01 18:50 十一的杂文录 阅读(766) 评论(0) 推荐(0) 编辑
摘要:网上有资料但是不全,所以这里记录一份比较全的 1.创建项目 2.编辑 demo.cpp 这里写button用来做国际化示例,运行软件后是这个样子 #include "demo.h" #include "ui_demo.h" #include <QPushButton> demo::demo(QWid 阅读全文
posted @ 2021-07-14 16:51 十一的杂文录 阅读(504) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示