当前位置: 首页 > news >正文

Qt 各种数据类型

目录

1. 基础类型

2. log 输出

3. 字符串类型

3.2 QByteArray

构造函数

数据操作

子字符串查找和判断

遍历

查看字节数

类型转换

3.3 QString

4. QVariant

4.1 标准类型

4.2 自定义类型

5. 位置和尺寸

5.1 QPoint

5.2 QLine

5.3 QSize

5.4 QRect

6. 日期和时间

6.1 QDate

6.2 QTime

6.3 QDateTime


1. 基础类型

因为Qt是一个C++ 框架, 因此C++中所有的语法和数据类型在Qt中都是被支持的, 但是Qt中也定义了一些属于自己的数据类型, 下边给大家介绍一下这些基础的数类型。

(Qt中的很多类型都是封装的cpp的,而且基本上就在前面加了Q/q)

QT基本数据类型定义在#include <QtGlobal> 中,QT基本数据类型有:

类型名称注释备注
qint8signed char有符号8位数据
qint16signed short16位数据类型
qint32signed short32位有符号数据类型
qint64long long int 或(__int64)64位有符号数据类型,Windows中定义为__int64
qintptrqint32 或 qint64指针类型 根据系统类型不同而不同,32位系统为qint32、64位系统为qint64
qlonglonglong long int 或(__int64)Windows中定义为__int64
qptrdiffqint32 或 qint64根据系统类型不同而不同,32位系统为qint32、64位系统为qint64
qrealdouble 或 float除非配置了-qreal float选项,否则默认为double
quint8unsigned char无符号8位数据类型
quint16unsigned short无符号16位数据类型
quint32unsigned int无符号32位数据类型
quint64unsigned long long int 或 (unsigned __int64)无符号64比特数据类型,Windows中定义为unsigned __int64
quintptrquint32 或 quint64根据系统类型不同而不同,32位系统为quint32、64位系统为quint64
qulonglongunsigned long long int 或 (unsigned __int64)Windows中定义为__int64
ucharunsigned char无符号字符类型
uintunsigned int无符号整型
ulongunsigned long无符号长整型
ushortunsigned short无符号短整型

2. log 输出

在Qt中进行log输出, 一般不使用c中的printf, 也不是使用C++中的cout, Qt框架提供了专门用于日志输出的类, 头文件名为 QDebug, 使用方法如下:

// 包含了QDebug头文件, 直接通过全局函数 qDebug() 就可以进行日志输出了
qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
qDebug() << "Custom coordinate type:" << coordinate;// 和全局函数 qDebug() 类似的日志函数还有: qWarning(), qInfo(), qCritical()
int number = 666;
float i = 11.11;
qWarning() << "Number:" << number << "Other value:" << i;
qInfo() << "Number:" << number << "Other value:" << i;
qCritical() << "Number:" << number << "Other value:" << i;

日志信息在IDE的调试窗口输出

如果想要在终端窗口中输出日志

使用上面的方法只能在项目调试过程中进行日志输出, 如果不是通过IDE进行程序调试, 而是直接执行可执行程序在这种情况下是没有日志输出窗口的, 因此也就看不到任何的日志输出。

打开项目文件(*.pro)找到配置项 config, 添加 console 控制台属性:

CONFIG += c++11 console

属性信息添加完毕, 重新编译项目 日志信息就可以打印到终端窗口了

3. 字符串类型

在Qt中不仅支持CC++中的字符串类型, 而且还在框架中定义了专属的字符串类型

语言类型字符串类型
Cchar*
C++std::stringchar*
QtQByteArrayQString 等

3.2 QByteArray

在Qt中QByteArray可以看做是c语言中 char*的升级版本。我们在使用这种类型的时候可通过这个类的构造函数申请一块动态内存,用于存储我们需要处理的字符串数据。

(函数基本上都是这样,大差不差)

构造函数

// 构造空对象, 里边没有数据
QByteArray::QByteArray();
// 将data中的size个字符进行构造, 得到一个字节数组对象
// 如果 size==-1 函数内部自动计算字符串长度, 计算方式为: strlen(data)
QByteArray::QByteArray(const char *data, int size = -1);
// 构造一个长度为size个字节, 并且每个字节值都为ch的字节数组
QByteArray::QByteArray(int size, char ch);

数据操作

// 在尾部追加数据
// 其他重载的同名函数可参考Qt帮助文档, 此处略
QByteArray &QByteArray::append(const QByteArray &ba);
void QByteArray::push_back(const QByteArray &other);// 头部添加数据
// 其他重载的同名函数可参考Qt帮助文档, 此处略
QByteArray &QByteArray::prepend(const QByteArray &ba);
void QByteArray::push_front(const QByteArray &other);// 插入数据, 将ba插入到数组第 i 个字节的位置(从0开始)
// 其他重载的同名函数可参考Qt帮助文档, 此处略
QByteArray &QByteArray::insert(int i, const QByteArray &ba);// 删除数据
// 从大字符串中删除len个字符, 从第pos个字符的位置开始删除
QByteArray &QByteArray::remove(int pos, int len);
// 从字符数组的尾部删除 n 个字节
void QByteArray::chop(int n);
// 从字节数组的 pos 位置将数组截断 (前边部分留下, 后边部分被删除)
void QByteArray::truncate(int pos);
// 将对象中的数据清空, 使其为null
void QByteArray::clear();// 字符串替换
// 将字节数组中的 子字符串 before 替换为 after
// 其他重载的同名函数可参考Qt帮助文档, 此处略
QByteArray &QByteArray::replace(const QByteArray &before, const QByteArray &after);

子字符串查找和判断

// 判断字节数组中是否包含子字符串 ba, 包含返回true, 否则返回false
bool QByteArray::contains(const QByteArray &ba) const;
bool QByteArray::contains(const char *ba) const;
// 判断字节数组中是否包含子字符 ch, 包含返回true, 否则返回false
bool QByteArray::contains(char ch) const;// 判断字节数组是否以字符串 ba 开始, 是返回true, 不是返回false
bool QByteArray::startsWith(const QByteArray &ba) const;
bool QByteArray::startsWith(const char *ba) const;
// 判断字节数组是否以字符 ch 开始, 是返回true, 不是返回false
bool QByteArray::startsWith(char ch) const;// 判断字节数组是否以字符串 ba 结尾, 是返回true, 不是返回false
bool QByteArray::endsWith(const QByteArray &ba) const;
bool QByteArray::endsWith(const char *ba) const;
// 判断字节数组是否以字符 ch 结尾, 是返回true, 不是返回false
bool QByteArray::endsWith(char ch) const;

遍历

// 使用迭代器
iterator QByteArray::begin();
iterator QByteArray::end();// 使用数组的方式进行遍历
// i的取值范围 0 <= i < size()
char QByteArray::at(int i) const;
char QByteArray::operator[](int i) const;

查看字节数

// 返回字节数组对象中字符的个数
int QByteArray::length() const;
int QByteArray::size() const;
int QByteArray::count() const;// 返回字节数组对象中 子字符串ba 出现的次数
int QByteArray::count(const QByteArray &ba) const;
int QByteArray::count(const char *ba) const;
// 返回字节数组对象中 字符串ch 出现的次数
int QByteArray::count(char ch) const;

类型转换

// 将QByteArray类型的字符串 转换为 char* 类型
char *QByteArray::data();
const char *QByteArray::data() const;// int, short, long, float, double -> QByteArray
// 其他重载的同名函数可参考Qt帮助文档, 此处略
QByteArray &QByteArray::setNum(int n, int base = 10);
QByteArray &QByteArray::setNum(short n, int base = 10);
QByteArray &QByteArray::setNum(qlonglong n, int base = 10);
QByteArray &QByteArray::setNum(float n, char f = 'g', int prec = 6);
QByteArray &QByteArray::setNum(double n, char f = 'g', int prec = 6);
[static] QByteArray QByteArray::number(int n, int base = 10);
[static] QByteArray QByteArray::number(qlonglong n, int base = 10);
[static] QByteArray QByteArray::number(double n, char f = 'g', int prec = 6);// QByteArray -> int, short, long, float, double
int QByteArray::toInt(bool *ok = Q_NULLPTR, int base = 10) const;
short QByteArray::toShort(bool *ok = Q_NULLPTR, int base = 10) const;
long QByteArray::toLong(bool *ok = Q_NULLPTR, int base = 10) const;
float QByteArray::toFloat(bool *ok = Q_NULLPTR) const;
double QByteArray::toDouble(bool *ok = Q_NULLPTR) const;// std::string -> QByteArray
[static] QByteArray QByteArray::fromStdString(const std::string &str);
// QByteArray -> std::string
std::string QByteArray::toStdString() const;// 所有字符转换为大写
QByteArray QByteArray::toUpper() const;
// 所有字符转换为小写
QByteArray QByteArray::toLower() const;

3.3 QString

QString也是封装了字符串, 但是内部的编码为utf8, UTF-8属于Unicode字符集, 它固定使用多个字节(window为2字节, linux为3字节)来表示一个字符,这样可以将世界上几乎所有语言的常用字符收录其中。

4. QVariant

QVariant这个类很神奇,或者说方便。很多时候,需要几种不同的数据类型需要传递,如果用结构体,又不大方便,容器保存的也只是一种数据类型,而QVariant则可以统统搞定。

QVariant 这个类型充当着最常见的数据类型的联合。QVariant 可以保存很多Qt的数据类型,包括QBrush、QColor、QCursor、QDateTime、QFont、QKeySequence、 QPalette、QPen、QPixmap、QPoint、QRect、QRegion、QSize和QString,并且还有C++基本类型,如 int、float等。

4.1 标准类型

将标准类型转换为QVariant类型

// 这类转换需要使用QVariant类的构造函数, 由于比较多, 大家可自行查阅Qt帮助文档, 在这里简单写几个
QVariant::QVariant(int val);
QVariant::QVariant(bool val);
QVariant::QVariant(double val);
QVariant::QVariant(const char *val);
QVariant::QVariant(const QByteArray &val);
QVariant::QVariant(const QString &val);
......// 使用设置函数也可以将支持的类型的数据设置到QVariant对象中
// 这里的 T 类型, 就是QVariant支持的类型
void QVariant::setValue(const T &value);
// 该函数行为和 setValue() 函数完全相同
[static] QVariant QVariant::fromValue(const T &value);
// 例子:
#if 1
QVariant v;
v.setValue(5);
#else
QVariant v = QVariant::fromValue(5);
#endifint i = v.toInt();          // i is now 5
QString s = v.toString();   // s is now "5"

判断 QVariant中封装的实际数据类型

// 该函数的返回值是一个枚举类型, 可通过这个枚举判断出实际是什么类型的数据
Type QVariant::type() const;

返回值Type的部分枚举定义, 全部信息可以自行查阅Qt帮助文档

将QVariant对象转换为实际的数据类型

// 如果要实现该操作, 可以使用QVariant类提供的 toxxx() 方法, 全部转换可以参考Qt帮助文档
// 在此举列举几个常用函数:
bool QVariant::toBool() const;
QByteArray QVariant::toByteArray() const;
double QVariant::toDouble(bool *ok = Q_NULLPTR) const;
float QVariant::toFloat(bool *ok = Q_NULLPTR) const;
int QVariant::toInt(bool *ok = Q_NULLPTR) const;
QString QVariant::toString() const;
......

4.2 自定义类型

除了标准类型, 我们自定义的类型也可以使用QVariant类进行封装, QVariant存储的数据类型需要有一个默认的构造函数和一个拷贝构造函数。为了实现这个功能,首先必须使用Q_DECLARE_METATYPE()宏。通常会将这个宏放在类的声明所在头文件的下面, 原型为:

Q_DECLARE_METATYPE(Type)

使用的具体步骤如下:

第一步: 在头文件中声明

// *.h
struct MyTest
{int id;QString name;
};
// 自定义类型注册
Q_DECLARE_METATYPE(MyTest)

第二步: 在源文件中定义

MyTest t;
t.name = "张三丰";
t.num = 666;
// 值的封装
QVariant vt = QVariant::fromValue(t);// 值的读取
if(vt.canConvert<MyTest>())
{MyTest t = vt.value<MyTest>();qDebug() << "name: " << t.name << ", num: " << t.num;
}

5. 位置和尺寸

5.1 QPoint

QPoint类封装了我们常用用到的坐标点 (x, y), 常用的 API如下:

// 构造函数
// 构造一个坐标原点, 即(0, 0)
QPoint::QPoint();
// 参数为 x轴坐标, y轴坐标
QPoint::QPoint(int xpos, int ypos);// 设置x轴坐标
void QPoint::setX(int x);
// 设置y轴坐标
void QPoint::setY(int y);// 得到x轴坐标
int QPoint::x() const;
// 得到x轴坐标的引用
int &QPoint::rx();
// 得到y轴坐标
int QPoint::y() const;
// 得到y轴坐标的引用
int &QPoint::ry();// 直接通过坐标对象进行算术运算: 加减乘除
QPoint &QPoint::operator*=(float factor);
QPoint &QPoint::operator*=(double factor);
QPoint &QPoint::operator*=(int factor);
QPoint &QPoint::operator+=(const QPoint &point);
QPoint &QPoint::operator-=(const QPoint &point);
QPoint &QPoint::operator/=(qreal divisor);

5.2 QLine

QLine是一个直线类, 封装了两个坐标点 (两点确定一条直线)

// 构造函数
// 构造一个空对象
QLine::QLine();
// 构造一条直线, 通过两个坐标点
QLine::QLine(const QPoint &p1, const QPoint &p2);
// 从点 (x1, y1) 到 (x2, y2)
QLine::QLine(int x1, int y1, int x2, int y2);// 给直线对象设置坐标点
void QLine::setPoints(const QPoint &p1, const QPoint &p2);
// 起始点(x1, y1), 终点(x2, y2)
void QLine::setLine(int x1, int y1, int x2, int y2);
// 设置直线的起点坐标
void QLine::setP1(const QPoint &p1);
// 设置直线的终点坐标
void QLine::setP2(const QPoint &p2);// 返回直线的起始点坐标
QPoint QLine::p1() const;
// 返回直线的终点坐标
QPoint QLine::p2() const;
// 返回值直线的中心点坐标, (p1() + p2()) / 2
QPoint QLine::center() const;// 返回值直线起点的 x 坐标
int QLine::x1() const;
// 返回值直线终点的 x 坐标
int QLine::x2() const;
// 返回值直线起点的 y 坐标
int QLine::y1() const;
// 返回值直线终点的 y 坐标
int QLine::y2() const;// 用给定的坐标点平移这条直线
void QLine::translate(const QPoint &offset);
void QLine::translate(int dx, int dy);
// 用给定的坐标点平移这条直线, 返回平移之后的坐标点
QLine QLine::translated(const QPoint &offset) const;
QLine QLine::translated(int dx, int dy) const;// 直线对象进行比较
bool QLine::operator!=(const QLine &line) const;
bool QLine::operator==(const QLine &line) const;

5.3 QSize

在QT中QSize类用来形容长度和宽度, 常用的API如下:

// 构造函数
// 构造空对象, 对象中的宽和高都是无效的
QSize::QSize();
// 使用宽和高构造一个有效对象
QSize::QSize(int width, int height);// 设置宽度
void QSize::setWidth(int width)
// 设置高度
void QSize::setHeight(int height);// 得到宽度
int QSize::width() const;
// 得到宽度的引用
int &QSize::rwidth();
// 得到高度
int QSize::height() const;
// 得到高度的引用
int &QSize::rheight();// 交换高度和宽度的值
void QSize::transpose();
// 交换高度和宽度的值, 返回交换之后的尺寸信息
QSize QSize::transposed() const;// 进行算法运算: 加减乘除
QSize &QSize::operator*=(qreal factor);
QSize &QSize::operator+=(const QSize &size);
QSize &QSize::operator-=(const QSize &size);
QSize &QSize::operator/=(qreal divisor);

5.4 QRect

在Qt中使用 QRect类来描述一个矩形, 常用的API如下:

// 构造函数
// 构造一个空对象
QRect::QRect();
// 基于左上角坐标, 和右下角坐标构造一个矩形对象
QRect::QRect(const QPoint &topLeft, const QPoint &bottomRight);
// 基于左上角坐标, 和 宽度, 高度构造一个矩形对象
QRect::QRect(const QPoint &topLeft, const QSize &size);
// 通过 左上角坐标(x, y), 和 矩形尺寸(width, height) 构造一个矩形对象
QRect::QRect(int x, int y, int width, int height);// 设置矩形的尺寸信息, 左上角坐标不变
void QRect::setSize(const QSize &size);
// 设置矩形左上角坐标为(x,y), 大小为(width, height)
void QRect::setRect(int x, int y, int width, int height);
// 设置矩形宽度
void QRect::setWidth(int width);
// 设置矩形高度
void QRect::setHeight(int height);// 返回值矩形左上角坐标
QPoint QRect::topLeft() const;
// 返回矩形右上角坐标
// 该坐标点值为: QPoint(left() + width() -1, top())
QPoint QRect::topRight() const;
// 返回矩形左下角坐标
// 该坐标点值为: QPoint(left(), top() + height() - 1)
QPoint QRect::bottomLeft() const;
// 返回矩形右下角坐标
// 该坐标点值为: QPoint(left() + width() -1, top() + height() - 1)
QPoint QRect::bottomRight() const;
// 返回矩形中心点坐标
QPoint QRect::center() const;// 返回矩形上边缘y轴坐标
int QRect::top() const;
int QRect::y() const;
// 返回值矩形下边缘y轴坐标
int QRect::bottom() const;
// 返回矩形左边缘 x轴坐标
int QRect::x() const;
int QRect::left() const;
// 返回矩形右边缘x轴坐标
int QRect::right() const;

6. 日期和时间

6.1 QDate

QDate类可以封装日期信息也可以通过这个类得到日期相关的信息, 包括:

// 构造函数
QDate::QDate();
QDate::QDate(int y, int m, int d);// 公共成员函数
// 重新设置日期对象中的日期
bool QDate::setDate(int year, int month, int day);
// 给日期对象添加 ndays 天
QDate QDate::addDays(qint64 ndays) const;
// 给日期对象添加 nmonths 月
QDate QDate::addMonths(int nmonths) const;
// 给日期对象添加 nyears 月
QDate QDate::addYears(int nyears) const;// 得到日期对象中的年/月/日
int QDate::year() const;
int QDate::month() const;
int QDate::day() const;
void QDate::getDate(int *year, int *month, int *day) const;// 日期对象格式化
/*d    - The day as a number without a leading zero (1 to 31)dd   - The day as a number with a leading zero (01 to 31)ddd	 - The abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses the system locale to localize the name, i.e. QLocale::system().dddd - The long localized day name (e.g. 'Monday' to 'Sunday'). Uses the system locale to localize the name, i.e. QLocale::system().M    - The month as a number without a leading zero (1 to 12)MM   - The month as a number with a leading zero (01 to 12)MMM	 - The abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses the system locale to localize the name, i.e. QLocale::system().MMMM - The long localized month name (e.g. 'January' to 'December'). Uses the system locale to localize the name, i.e. QLocale::system().yy   - The year as a two digit number (00 to 99)yyyy - The year as a four digit number. If the year is negative, a minus sign is prepended, making five characters.
*/
QString QDate::toString(const QString &format) const;// 操作符重载 ==> 日期比较
bool QDate::operator!=(const QDate &d) const;
bool QDate::operator<(const QDate &d) const;
bool QDate::operator<=(const QDate &d) const;
bool QDate::operator==(const QDate &d) const;
bool QDate::operator>(const QDate &d) const;
bool QDate::operator>=(const QDate &d) const;// 静态函数 -> 得到本地的当前日期

6.2 QTime

QTime类可以封装时间信息也可以通过这个类得到时间相关的信息, 包括:毫秒

// 构造函数
QTime::QTime();
/*h 		==> 取值范围: 0 ~ 23m and s 	==> 取值范围: 0 ~ 59ms 		==> 取值范围: 0 ~ 999
*/ 
QTime::QTime(int h, int m, int s = 0, int ms = 0);// 公共成员函数
// Returns true if the set time is valid; otherwise returns false.
bool QTime::setHMS(int h, int m, int s, int ms = 0);
QTime QTime::addSecs(int s) const;
QTime QTime::addMSecs(int ms) const;// 示例代码QTime n(14, 0, 0);                // n == 14:00:00QTime t;t = n.addSecs(70);                // t == 14:01:10t = n.addSecs(-70);               // t == 13:58:50t = n.addSecs(10 * 60 * 60 + 5);  // t == 00:00:05t = n.addSecs(-15 * 60 * 60);     // t == 23:00:00// 从时间对象中取出 时/分/秒/毫秒
// Returns the hour part (0 to 23) of the time. Returns -1 if the time is invalid.
int QTime::hour() const;
// Returns the minute part (0 to 59) of the time. Returns -1 if the time is invalid.
int QTime::minute() const;
// Returns the second part (0 to 59) of the time. Returns -1 if the time is invalid.
int QTime::second() const;
// Returns the millisecond part (0 to 999) of the time. Returns -1 if the time is invalid.
int QTime::msec() const;// 时间格式化
/*-- 时 --h	==>	The hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)hh	==>	The hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)H	==>	The hour without a leading zero (0 to 23, even with AM/PM display)HH	==>	The hour with a leading zero (00 to 23, even with AM/PM display)-- 分 --m	==>	The minute without a leading zero (0 to 59)mm	==>	The minute with a leading zero (00 to 59)

6.3 QDateTime

QDateTime类可以封装日期和时间信息也可以通过这个类得到日期和时间相关的信息, 包括:毫秒。其实这个类就是QDate 和 QTime 这两个类的结合体。

// 构造函数
QDateTime::QDateTime();
QDateTime::QDateTime(const QDate &date, const QTime &time, Qt::TimeSpec spec = Qt::LocalTime);// 公共成员函数
// 设置日期
void QDateTime::setDate(const QDate &date);
// 设置时间
void QDateTime::setTime(const QTime &time);
// 给当前日期对象追加 年/月/日/秒/毫秒, 参数可以是负数
QDateTime QDateTime::addYears(int nyears) const;
QDateTime QDateTime::addMonths(int nmonths) const;
QDateTime QDateTime::addDays(qint64 ndays) const;
QDateTime QDateTime::addSecs(qint64 s) const;
QDateTime QDateTime::addMSecs(qint64 msecs) const;// 得到对象中的日期
QDate QDateTime::date() const;
// 得到对象中的时间
QTime QDateTime::time() const;// 日期和时间格式, 格式字符参考QDate 和 QTime 类的 toString() 函数
QString QDateTime::toString(const QString &format) const;// 操作符重载 ==> 日期时间对象的比较
bool QDateTime::operator!=(const QDateTime &other) const;
bool QDateTime::operator<(const QDateTime &other) const;
bool QDateTime::operator<=(const QDateTime &other) const;
bool QDateTime::operator==(const QDateTime &other) const;
bool QDateTime::operator>(const QDateTime &other) const;
bool QDateTime::operator>=(const QDateTime &other) const;// 静态函数
// 得到当前时区的日期和时间(本地设置的时区对应的日期和时间)
[static] QDateTime QDateTime::currentDateTime();

相关文章:

Qt 各种数据类型

目录 1. 基础类型 2. log 输出 3. 字符串类型 3.2 QByteArray 构造函数 数据操作 子字符串查找和判断 遍历 查看字节数 类型转换 3.3 QString 4. QVariant 4.1 标准类型 4.2 自定义类型 5. 位置和尺寸 5.1 QPoint 5.2 QLine 5.3 QSize 5.4 QRect 6. 日期和…...

电动车展示预约小程序的作用如何

电动车可以说是现在出行常见的方法&#xff0c;覆盖年龄广几乎是每家必备&#xff0c;也有不小大小品牌和经销商&#xff0c;市场需求较高&#xff0c;但在实际经营中&#xff0c;对经销商来时也面临着一些痛点&#xff1a; 1、品牌传播产品展示难 不同品牌竞争很大&#xff…...

「随笔」浅谈2023年云计算的发展趋势

在2023年&#xff0c;云计算的发展趋势将受到政治、经济、社会和科技四个维度的影响。以下是对这些维度的具体分析&#xff1a; 1.1 政治维度&#xff1a; 全球政策推动&#xff1a; 随着全球各国政策对云计算的重视程度不断提高&#xff0c;云计算服务将获得更广泛的市场准入…...

高性能三防工业平板电脑 防摔防爆电容屏工控平板

HT1000是一款高性能工业三防平板&#xff0c;10.1英寸超清大屏&#xff0c;厚度仅14.9mm&#xff0c;超薄机身&#xff0c;可轻松插入袋中&#xff0c;方便携带&#xff0c;搭载8核2.0GHz高性能CPU&#xff0c;行业领先的Android 11.0&#xff0c;设备性能大幅提升&#xff0c;…...

mac flutter pb解析报错:protoc-gen-dart: program not found or is not executable

在mac对pb文件转dart文件的时候报错&#xff1a;protoc-gen-dart: program not found or is not executable 原因是没有安装protoc-gen-dart或者protoc-gen-dart没有设置到环境变量中 解决办法&#xff1a; 1、安装protoc-gen-dart flutter pub global activate protoc_plu…...

PostgreSQL 连接是否要通过SSL,为什么使用SSL 连接后,业务部门会投诉我?

开头还是介绍一下群&#xff0c;如果感兴趣PolarDB ,MongoDB ,MySQL ,PostgreSQL ,Redis, Oceanbase, Sql Server等有问题&#xff0c;有需求都可以加群群内有各大数据库行业大咖&#xff0c;CTO&#xff0c;可以解决你的问题。加群请联系 liuaustin3 &#xff0c;&#xff08;…...

Linux驱动开发——USB设备驱动

目录 一、 USB 协议简介 二、 Linux USB 驱动 三、 USB 设备驱动实例 一、 USB 协议简介 USB(Universal Serial Bus&#xff0c;通用串行总线)正如它的名字一样&#xff0c;是用来连接PC外设的一种通用串行总线&#xff0c;即插即用和易扩展是它最大的特点。所谓即插即用&am…...

微服务使用指南

微服务使用指南 1.初识微服务 微服务可以认为是一种分布式架构的解决方案&#xff0c;提供服务的独立性和完整性&#xff0c;做到服务的高内聚、低耦合。 目前服务架构主要包含&#xff1a;单体架构和分布式架构。 1.1 单体架构 单体架构&#xff1a;把所有业务功能模块都…...

MYSQL运维篇(已完结)

一、日志 1. 错误日志 2. 二进制日志 &#x1f60e; 介绍 &#x1f60e; 日志格式 &#x1f60e; 日志查看 &#x1f60e; 日志删除 3. 查询日志 4. 慢查询日志 二、主从复制 1. 概述 2. 原理 3. 搭建 4. 总结 三、分库分表 1. 介绍 &#x1f364; 问题分析 &#x1f364;…...

MapReduce性能优化之小文件问题和数据倾斜问题解决方案

文章目录 MapReduce性能优化小文件问题生成SequenceFileMapFile案例 &#xff1a;使用SequenceFile实现小文件的存储和计算 数据倾斜问题实际案例 MapReduce性能优化 针对MapReduce的案例我们并没有讲太多&#xff0c;主要是因为在实际工作中真正需要我们去写MapReduce代码的场…...

面向萌新的数学建模入门指南

时间飞逝&#xff0c;我的大一建模生涯也告一段落。感谢建模路上帮助过我的学长和学姐们&#xff0c;滴水之恩当涌泉相报&#xff0c;写下这篇感想&#xff0c;希望可以给学弟学妹们一丝启发&#xff0c;也就完成我的想法了。拙劣的文笔&#xff0c;也不知道写些啥&#xff0c;…...

基于 golang 从零到一实现时间轮算法 (二)

Go实现单机版时间轮 上一章介绍了时间轮的相关概念&#xff0c;接下来我们会使用 golang 标准库的定时器工具 time ticker 结合环状数组的设计思路&#xff0c;实现一个单机版的单级时间轮。 首先我们先运行一下下面的源码&#xff0c;看一下如何使用。 https://github.com/x…...

【系统架构设计】架构核心知识: 5 系统安全性与保密性设计

目录 一 信息安全基础 1 信息安全的基本要素 2 信息安全的范围 3 网络安全...

无人零售奶柜:革新牛奶购买体验

无人零售奶柜&#xff1a;革新牛奶购买体验 无人零售奶柜的投放地点覆盖了社区、写字楼等靠近居民的场所&#xff0c;大大提升了消费者购买牛奶的体验。这一创新不仅令消费者能够享受到与电商平台相媲美的直供价格优势&#xff0c;还让他们能够购买更多、更丰富的知名品牌牛奶。…...

【Mybatis小白从0到90%精讲】15: Mybatis配置打印SQL日志

文章目录 前言配置日志实现前言 日志(Log)是每个程序都不可或缺的一部分,它可以帮助开发人员诊断和调试问题。Mybatis,作为一款备受赞誉的ORM框架,自然也提供了强大的日志功能。 它不仅提供了内置的标准实现,还支持集成各种主流的日志框架,让我们可以轻松地查看最终执行…...

vue3-video-play视频播放组件

安装&#xff1a; npm i vue3-video-play --save使用说明&#xff1a; https://codelife.cc/vue3-video-play/guide/install.html...

vue项目中页面遇到404报错

vue页面访问正常&#xff0c;但是一刷新就会404的问题解决办法&#xff1a; 1.解决方法&#xff1a; 将vue的路由模式 mode: history 修改为 mode: hash模式 //router.js文件 const router new Router({//mode: history, mode: hash,routes: [{ path: /, redirect: /login …...

快手直播弹幕websocket protobuf序列化与反序列化

系列文章目录 websocket训练地址:https://www.qiulianmao.com,正在搭建中 基础-websocket逆向基础-http拦截基础-websocket拦截基础-base64编码与解码基础-python实现protobuf序列化与反序列化基础-前端js实现protobuf序列化与反序列化基础-protobufjs实现protobuf序列化与反…...

viple入门(三)

&#xff08;1&#xff09;条件循环活动 条件循环活动中&#xff0c;必须给定条件&#xff0c;条件成立&#xff0c;则执行条件循环的后续程序。 条件不成立&#xff0c;则不执行后续程序。 从报错信息来看&#xff0c;程序提示&#xff1a;条件循环要和结束循环活动一起使用。…...

Vue渲染函数渲染html

版本 vue2.6 使用 domProps属性 domProps: {innerHTML: xxx},官方文档...

强化学习在并行机构人形机器人控制中的应用

1. 项目概述在机器人控制领域&#xff0c;强化学习(RL)正逐渐成为解决复杂动力学系统问题的有力工具。然而&#xff0c;当面对具有并行驱动机构的人形机器人时&#xff0c;传统RL训练方法往往面临一个关键挑战&#xff1a;大多数仿真环境无法准确模拟闭环运动链(Closed Kinemat…...

ComfyUI-Manager终极指南:3个核心功能彻底解决AI工作流管理难题

ComfyUI-Manager终极指南&#xff1a;3个核心功能彻底解决AI工作流管理难题 【免费下载链接】ComfyUI-Manager ComfyUI-Manager is an extension designed to enhance the usability of ComfyUI. It offers management functions to install, remove, disable, and enable vari…...

别再乱算相似度了!用Python实战二元变量聚类:从Jaccard系数到病人分组

医疗数据分析实战&#xff1a;用Python实现基于Jaccard系数的病人症状聚类在医疗数据分析领域&#xff0c;如何从海量病人症状数据中发现潜在规律一直是临床研究的难点。传统方法往往依赖医生经验或简单统计&#xff0c;而现代数据挖掘技术为我们提供了更科学的解决方案。本文将…...

半导体元件(二极管/三极管/MOS管/IC)损坏诊断全解

半导体元件&#xff08;二极管、三极管、MOS 管、集成电路&#xff09;是 PCB 的核心功能单元&#xff0c;对过压、过流、ESD、高温极度敏感&#xff0c;损坏后直接导致电路功能失效、短路烧板。很多工程师维修时盲目更换芯片&#xff0c;不仅成本高&#xff0c;还易误判。​一…...

具身智能:面向新兴交叉学科建设的思考与建议 2026

这份由 CCF YOCSEF 长三角五地学术委员会 2026 年 5 月发布的白皮书&#xff0c;聚焦具身智能作为新兴交叉学科的建设&#xff0c;明确其并非 AI 与机器人学的简单拼接&#xff0c;而是围绕物理交互中的智能行为形成的新问题域&#xff0c;提出 “三大基本问题 一个应用需求”…...

BiliRoamingX:彻底解决B站体验限制的完整增强方案

BiliRoamingX&#xff1a;彻底解决B站体验限制的完整增强方案 【免费下载链接】BiliRoamingX-integrations BiliRoamingX integrations and patches powered by ReVanced. 项目地址: https://gitcode.com/gh_mirrors/bi/BiliRoamingX-integrations 你是否曾为B站的内容区…...

通过curl命令快速测试Taotoken大模型API的连通性与返回格式

&#x1f680; 告别海外账号与网络限制&#xff01;稳定直连全球优质大模型&#xff0c;限时半价接入中。 &#x1f449; 点击领取海量免费额度 通过curl命令快速测试Taotoken大模型API的连通性与返回格式 在集成大模型能力到应用时&#xff0c;开发者通常需要一种快速、轻量的…...

总线式智能提示灯系统设计:从恒流驱动到模块化架构

1. 项目概述&#xff1a;从传统到智能的剧场提示灯系统革新在剧场、演播室或者大型活动现场的后台&#xff0c;如果你待过&#xff0c;一定对那套“红灯停&#xff0c;绿灯行”的提示灯系统不陌生。导演或舞台监督通过对讲机喊“Standby”&#xff08;准备&#xff09;&#xf…...

【大模型聚合平台深度评测:阿里云百炼 vs 腾讯云 ADP,企业如何选型?】

大模型聚合平台深度评测&#xff1a;阿里云百炼 vs 腾讯云 ADP&#xff0c;企业如何选型&#xff1f; 随着大模型技术的快速发展&#xff0c;越来越多的企业开始将 AI 能力融入到业务流程中。然而&#xff0c;面对市场上众多的大模型产品&#xff0c;企业往往面临着 “选择困难…...

AWS DevOps Agent 完全指南

AWS DevOps Agent 是 AWS 推出的前沿 AI 运维代理,自主调查和解决事件、持续预防故障、提升系统可靠性。本文档覆盖从原理到实战的全生命周期管理。 一、定位与价值 一句话定义 AWS DevOps Agent = AI 驱动的 SRE 队友,724 自主调查告警、定位根因、生成修复方案、预防未来…...