- 博客(27)
- 资源 (2)
- 收藏
- 关注
原创 Qt对限定的区域进行绘制
#include "QtGuiApplication1.h"#include <QPainter>#include <QPen>QtGuiApplication1::QtGuiApplication1(QWidget *parent) : QWidget(parent){ ui.setupUi(this); m_picFile = QCoreApplication::applicationDirPath() + "/8.bmp";}typedef stru.
2022-02-28 15:47:39
1017
原创 c++同步并发操作
#pragma once#include <QtWidgets/QWidget>#include "ui_future_test.h"#include <future>class future_test : public QWidget{ Q_OBJECTpublic: future_test(QWidget *parent = Q_NULLPTR);public slots:void on_pushbuton_clicked();void on_.
2022-02-03 16:07:14
661
原创 qt下载ftp文件并自动解压
下载函数void downloadPackage(const StuFtpInfo& info,const QString& strLocalPath){ QUrl url; url.setScheme("ftp"); url.setHost(info.strHost); url.setPath(QString("/%1").arg(info.strFile)); url.setPort(21); url.setPassword(info.strPwd); url.
2021-12-21 19:38:23
335
原创 Qt 自定义提示框
#pragma once#include <QObject>#include <QScopedPointer> class QLabel;class QPushButton;class QFrame;class QDialog;class TipMessage:public QObject{ Q_OBJECTpublic: enum enMsgType { MT_SUCCESS = 0, MT_ERROR, MT_WARN, MT_I.
2021-09-10 16:11:42
220
原创 qt与s交互设计
qt代码1、main#include "ledshowdemo.h"#include <QtWidgets/QApplication>int main(int argc, char *argv[]){ QApplication a(argc, argv); LedShowDemo w; w.show(); return a.exec();}2、LedShowDemo.h#ifndef LEDSHOWDEMO_H#define LEDSHOWDE
2021-03-26 17:57:46
292
原创 QT_MVC使用例子
TableModel.h#pragma once#include <QObject>#include <QAbstractItemModel>struct FlashIndexData{ FlashIndexData() :is_be_checked(false){ } bool is_be_checked; quint32 unix_time; quint16 addr;};class TableModel : public QAbstractIte
2020-12-13 17:34:28
542
原创 CryptoPP加密算法库使用
#include "include/cryptlib.h"#include "include/aes.h"#include "include/osrng.h"#include "include/modes.h"#include "include/base64.h"#include "include/files.h"#include "include/filters.h"#include "include/default.h"#include "include/hex.h"#include.
2020-12-08 19:22:03
968
1
原创 python将png转换为ico
"""Author:Robin·QINotes:将图片转换为ico格式""" # PythonMargick包可以到Unofficial Windows Binaries for Python Extension Packages下载import PythonMagick img = PythonMagick.Image('robin.jpg')# 这里要设置一下尺寸,不然会报ico尺寸异常错误img.sample('128x128')img.write('robin.ico').
2020-12-07 00:21:03
1236
原创 QDirIterator获取目录下的所有文件
例子:QDirIterator qdi(QCoreApplication::applicationDirPath(), QStringList() << "*.txt", QDir::NoSymLinks | QDir::Files, QDirIterator::Subdirectories); while (qdi.hasNext()) { addText(qdi.hasNext()); }假设要获取应用程序目录下的所有txt文件,可使用上述方法...
2020-05-11 20:43:57
552
原创 QThread中moveToThread的用法
一、创建对象,要继承QbjectTableItem.h#pragma once#include <QObject>#include <QTableWidget>#include <QThread>#include <QDebug>class TableItem : public QObject{ Q_OBJECTpubl...
2020-03-22 21:28:24
783
原创 俩个类交叉使用
#include "a.h"#include "b.h"class A;class B;在类B中使用类A,则在类别的头文件中添加class A ,在b.cpp中包含类A的头文件。
2020-01-02 20:22:39
170
原创 Qt中TCP通信
总体流程客户端部分UI部分TcpClient.h#pragma once#include <QtWidgets/QWidget>#include "ui_TcpClient.h"#include <QTcpSocket>#include <QHostAddress>class TcpClient : public QWid...
2019-12-09 00:07:17
218
原创 QT中QWebEngineView模块
声明:QT版本5.6以上+vs2012;工程中要添加Qt5WebEngineWidgetsd.lib库及QWebEngineView头文件所在路径1、工程目录2、webtest.h文件#ifndef WEBTEST_H#define WEBTEST_H#include <QtWidgets/QWidget>#include "ui_webtest.h"#in...
2019-11-29 23:00:30
1451
1
原创 Qt绘图
1、绘图设备QWidget、QPixmap、QImage,这些绘图设备为QPainter提供一个“画布”2、要在绘图设备上绘图,只需要重定义paintEvent()事件并编写响应代码3、QPainter绘图的主要属性QPen用于控制线条的颜色,宽度,线型等QBrush用于设置一个区域的填充特性,可以设置填充颜色。填充方式,渐变特性等,还能填充图片QFont用于绘制文字时,...
2019-11-27 21:35:34
169
原创 Qt动画效果QPropertyAnimation
1、QPropertyAnimation类常见QPropertyAnimation对象QPropertyAnimation构造函数QPropertyAnimation::QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = Q_NULLPTR)target...
2019-11-27 20:21:30
343
原创 QT 线程池使用案例
头文件#ifndef MYRUNNABLE_H#define MYRUNNABLE_H#include <QObject>#include <QRunnable>#include <QDebug>#include <QThread>#include <QThreadPool>class MyRunnable : p...
2019-11-23 15:59:59
634
原创 QStyledItemDelegate自定义代理组件
1、继承QStyledItemDelegate自定义类组件2、重写函数3、通过在QTableView中插入自定义代理组件为例继承QStyledItemDelegate写的头文件#ifndef CUSTOMPUSHBOTTONDELEGATE_H#define CUSTOMPUSHBOTTONDELEGATE_H#include <QObject>#includ...
2019-11-22 19:15:29
1269
原创 QVariant自定义数据类型
struct STUMyStruct{ int age; QString name;};Q_DECLARE_METATYPE(STUMyStruct)QVariant v;STUMyStruct man;man.age = 1;man.name = "sdg";v = QVariant::fromValue(man);STUMyStruct v1 = v.value&l...
2019-11-22 15:04:15
2185
原创 在Ubuntu16.04中设置默认Python3.5的命令
直接执行这两个命令即可:sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150 如果要切换到Python2,执
2017-10-19 20:21:49
2788
原创 Scrapy在Ubuntu中的配置
首先python、lxml、OpenSSL这些工具Ubuntu是自带的,不用管它们。其次安装pip,在命令行中执行以下命令:sudo apt-get install python-pip1然后安装两个安装Scrapy需要的依赖库,在命令行中分别执行以下三条命令:sudo apt-get install python-devsudo apt-get install libe
2017-10-18 21:49:20
394
原创 Python学习笔记(六):数据可视化
1、使用matplotlib绘制图形1、1 绘制折线图import matplotlib.pyplot as pltb=[1,2,3,4,5,6,7]a=[1,4,9,16,25,36,49]plt.plot(b,a,linewidth=5)plt.title('square nums',fontsize=24)plt.xlabel('value',fontsize=14)
2017-10-10 10:25:56
765
原创 Python学习笔记(五):文件和异常
1、从文件中读取数据1、1 读取整个文件with open('digits.txt') as file_object: contents=file_object.read() print contents.rstrip()1)在文件所在目录建立文件digits.txt后,函数open()打开文件存储到变量file_object中2)关键字with在不需要访问文件后将其关闭
2017-10-09 10:45:44
253
原创 Python学习笔记(四):类的使用
class Human(object): def _init_(self,name,age): self.name=name self.age=age def eat(self): print self.name.title()+' is eating' def sleep(self): print self.name.title()+' must go to sle
2017-10-08 16:31:55
303
原创 Python学习笔记(二):if语句的使用
1、if 表达式:语句1else:语句2例如:a=3b=4if a==b: print("yes")else: print("no")注:缩进必须保持一致,table键不等于空格键。2、if 表达式:语句1elif 表达式:语句2else 表达式:语句3例如:a=3b=4if a==b: print("yes")elif a>b
2017-09-11 22:40:46
217
原创 Python学习笔记(一):方法、函数的使用
1、关于input的用法input()不管输入的是字符还是数字,input接受的都是字符串,若要将字符转换为数字用int(),若要将数字转换为字符用str()2、type(name)得出name的类型
2017-09-11 22:31:12
334
原创 关于在安装matplotlib中遇到ImportError: DLL load failed:找不到指定程序的解决办法
由于科研的需要,自学了PYTHON中的matplotlib模块,第一次安装的时候失败了,提示最好不要在线安装,在线安装 就会出现我下面的问题:缺少某些DLL。下面推荐参考别人(http://blog.csdn.net/lzhalan2016/article/details/52415998)的做法安装 成功的方法:1.首先下载4个whl格式的文件(1)matplotli
2017-08-30 11:20:10
16028
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人