更新代码

master
feiyangqingyun 2021-08-04 15:50:36 +08:00
parent f3a944679c
commit bf6c0a95dd
5 changed files with 96 additions and 2 deletions

View File

@ -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">

41
core_qui/base64.cpp Normal file
View File

@ -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()));
}

37
core_qui/base64.h Normal file
View File

@ -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. Qt6base64200%
*/
#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

View File

@ -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 \

View File

@ -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);
}