更新代码
|
@ -20,12 +20,12 @@ void EmailAddress::setAddress(const QString &address)
|
|||
this->address = address;
|
||||
}
|
||||
|
||||
const QString &EmailAddress::getName() const
|
||||
const QString EmailAddress::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
const QString &EmailAddress::getAddress() const
|
||||
const QString EmailAddress::getAddress() const
|
||||
{
|
||||
return address;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class EmailAddress : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
|
||||
EmailAddress();
|
||||
explicit EmailAddress();
|
||||
EmailAddress(const QString &address, const QString &name = "");
|
||||
|
||||
~EmailAddress();
|
||||
|
@ -16,8 +16,8 @@ public:
|
|||
void setName(const QString &name);
|
||||
void setAddress(const QString &address);
|
||||
|
||||
const QString &getName() const;
|
||||
const QString &getAddress() const;
|
||||
const QString getName() const;
|
||||
const QString getAddress() const;
|
||||
|
||||
private:
|
||||
QString name;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#include "base64.h"
|
||||
#include "qbuffer.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QString Base64::imageToBase64(const QImage &image)
|
||||
{
|
||||
return QString(imageToBase64x(image));
|
||||
}
|
||||
|
||||
QByteArray Base64::imageToBase64x(const QImage &image)
|
||||
{
|
||||
//这个转换可能比较耗时建议在线程中执行
|
||||
QByteArray data;
|
||||
QBuffer buffer(&data);
|
||||
image.save(&buffer, "JPG");
|
||||
data = data.toBase64();
|
||||
return data;
|
||||
}
|
||||
|
||||
QImage Base64::base64ToImage(const QString &data)
|
||||
{
|
||||
return base64ToImagex(data.toUtf8());
|
||||
}
|
||||
|
||||
QImage Base64::base64ToImagex(const QByteArray &data)
|
||||
{
|
||||
//这个转换可能比较耗时建议在线程中执行
|
||||
QImage image;
|
||||
image.loadFromData(QByteArray::fromBase64(data));
|
||||
return image;
|
||||
}
|
||||
|
||||
QString Base64::textToBase64(const QString &text)
|
||||
{
|
||||
return QString(text.toLocal8Bit().toBase64());
|
||||
}
|
||||
|
||||
QString Base64::base64ToText(const QString &text)
|
||||
{
|
||||
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
/**
|
||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
||||
* 1. 图片转base64字符串
|
||||
* 2. base64字符串转图片
|
||||
* 3. 字符转base64字符串
|
||||
* 4. base64字符串转字符
|
||||
* 5. 后期增加数据压缩
|
||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%
|
||||
*/
|
||||
|
||||
#include <QImage>
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT Base64
|
||||
#else
|
||||
class Base64
|
||||
#endif
|
||||
|
||||
{
|
||||
public:
|
||||
//图片转base64字符串
|
||||
static QString imageToBase64(const QImage &image);
|
||||
static QByteArray imageToBase64x(const QImage &image);
|
||||
|
||||
//base64字符串转图片
|
||||
static QImage base64ToImage(const QString &data);
|
||||
static QImage base64ToImagex(const QByteArray &data);
|
||||
|
||||
//字符串与base64互转
|
||||
static QString textToBase64(const QString &text);
|
||||
static QString base64ToText(const QString &text);
|
||||
};
|
||||
|
||||
#endif // BASE64_H
|
|
@ -22,11 +22,13 @@ include ($$PWD/h3.pri)
|
|||
|
||||
HEADERS += \
|
||||
$$PWD/appinit.h \
|
||||
$$PWD/base64.h \
|
||||
$$PWD/iconhelper.h \
|
||||
$$PWD/quihelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/appinit.cpp \
|
||||
$$PWD/base64.cpp \
|
||||
$$PWD/iconhelper.cpp \
|
||||
$$PWD/quihelper.cpp
|
||||
|
||||
|
|
|
@ -171,10 +171,8 @@ void QUIHelper::setFont(int fontSize)
|
|||
#endif
|
||||
|
||||
#ifndef rk3399
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
|
||||
qApp->setFont(font);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void QUIHelper::setCode(bool utf8)
|
||||
|
|
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 145 KiB |
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 94 KiB |