diff --git a/comtool/form/frmcomtool.ui b/comtool/form/frmcomtool.ui index bf1f20a..49d3621 100644 --- a/comtool/form/frmcomtool.ui +++ b/comtool/form/frmcomtool.ui @@ -105,6 +105,9 @@ 0 + + true + @@ -122,6 +125,9 @@ 0 + + true + @@ -191,7 +197,7 @@ QTabWidget::South - 1 + 0 diff --git a/core_qui/base64.cpp b/core_qui/base64.cpp new file mode 100644 index 0000000..1e0b100 --- /dev/null +++ b/core_qui/base64.cpp @@ -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())); +} diff --git a/core_qui/base64.h b/core_qui/base64.h new file mode 100644 index 0000000..2e864b7 --- /dev/null +++ b/core_qui/base64.h @@ -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 + +#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 diff --git a/core_qui/core_qui.pri b/core_qui/core_qui.pri index e8980ee..d554096 100644 --- a/core_qui/core_qui.pri +++ b/core_qui/core_qui.pri @@ -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 \ diff --git a/core_qui/quihelper.cpp b/core_qui/quihelper.cpp index 2b2fe2f..2548748 100644 --- a/core_qui/quihelper.cpp +++ b/core_qui/quihelper.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); }