更新代码
parent
f3a944679c
commit
bf6c0a95dd
|
@ -105,6 +105,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
|
@ -122,6 +125,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
|
@ -191,7 +197,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
|
|
@ -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
|
|
@ -21,6 +21,7 @@ CONFIG += resources_big
|
|||
include ($$PWD/h3.pri)
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/base64.h \
|
||||
$$PWD/iconhelper.h \
|
||||
$$PWD/quiconfig.h \
|
||||
$$PWD/quidateselect.h \
|
||||
|
@ -33,6 +34,7 @@ HEADERS += \
|
|||
$$PWD/quiwidget.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/base64.cpp \
|
||||
$$PWD/iconhelper.cpp \
|
||||
$$PWD/quiconfig.cpp \
|
||||
$$PWD/quidateselect.cpp \
|
||||
|
|
|
@ -300,7 +300,11 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, bool tool, bool top, bool
|
|||
widgetMain->setProperty("canMove", true);
|
||||
|
||||
//根据设定逐个追加属性
|
||||
#ifdef __arm__
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
#else
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint);
|
||||
#endif
|
||||
if (tool) {
|
||||
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::Tool);
|
||||
}
|
||||
|
@ -323,8 +327,12 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, QWidget *widgetTitle,
|
|||
widgetMain->setProperty("form", true);
|
||||
widgetMain->setProperty("canMove", true);
|
||||
|
||||
//根据设定逐个追加属性 去掉了 Qt::X11BypassWindowManagerHint
|
||||
//根据设定逐个追加属性
|
||||
#ifdef __arm__
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
#else
|
||||
widgetMain->setWindowFlags(Qt::FramelessWindowHint);
|
||||
#endif
|
||||
if (tool) {
|
||||
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::Tool);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue