diff --git a/core_qui/quihelper.cpp b/core_qui/quihelper.cpp index 3ee8e4a..527e3ea 100644 --- a/core_qui/quihelper.cpp +++ b/core_qui/quihelper.cpp @@ -597,15 +597,19 @@ int QUIHelper::byteToUShortRec(const QByteArray &data) return i; } -QString QUIHelper::getXorEncryptDecrypt(const QString &str, char key) +QString QUIHelper::getXorEncryptDecrypt(const QString &value, char key) { - QByteArray data = str.toLatin1(); - int size = data.size(); - for (int i = 0; i < size; i++) { - data[i] = data[i] ^ key; + //矫正范围外的数据 + if (key < 0 || key >= 127) { + key = 127; } - return QLatin1String(data); + QString result = value; + int count = result.count(); + for (int i = 0; i < count; i++) { + result[i] = QChar(result.at(i).toLatin1() ^ key); + } + return result; } uchar QUIHelper::getOrCode(const QByteArray &data) diff --git a/core_qui/quihelper.h b/core_qui/quihelper.h index 9d4d8b3..47cd806 100644 --- a/core_qui/quihelper.h +++ b/core_qui/quihelper.h @@ -110,8 +110,8 @@ public: static int byteToUShort(const QByteArray &data); static int byteToUShortRec(const QByteArray &data); - //异或加密算法 - static QString getXorEncryptDecrypt(const QString &str, char key); + //异或加密-只支持字符,如果是中文需要将其转换base64编码 + static QString getXorEncryptDecrypt(const QString &value, char key); //异或校验 static uchar getOrCode(const QByteArray &data); //计算校验码 diff --git a/ntpclient/ntpclient.cpp b/ntpclient/ntpclient.cpp index ff35b03..d7fb2fe 100644 --- a/ntpclient/ntpclient.cpp +++ b/ntpclient/ntpclient.cpp @@ -85,10 +85,12 @@ void NtpClient::readData() QDateTime dateTime; uint secs = seconds - epoch.secsTo(unixStart); - //两个方法二选一由于Qt6移除了setTime_t方法所以要自己计算 - //dateTime.setTime_t(secs); - dateTime.setDate(QDate(1970, 1, 1).addDays(secs / 86400)); - dateTime.setTime(QTime().addSecs(secs % 86400 + (8 * 60 * 60))); + +#if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) + dateTime.setTime_t(secs); +#else + dateTime.setSecsSinceEpoch(secs); +#endif #ifdef __arm__ #ifdef arma9 diff --git a/styledemo/head.h b/styledemo/head.h index 3d68241..a8d5a79 100644 --- a/styledemo/head.h +++ b/styledemo/head.h @@ -1,8 +1,12 @@ #include #include -#include + #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) #include #endif +#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) +#include +#endif + #pragma execution_character_set("utf-8") diff --git a/styledemo/styledemo.pro b/styledemo/styledemo.pro index 19c587a..f406a98 100644 --- a/styledemo/styledemo.pro +++ b/styledemo/styledemo.pro @@ -18,9 +18,9 @@ DESTDIR = $$PWD/../bin CONFIG += warn_off SOURCES += main.cpp -SOURCES += frmmain.cpp HEADERS += head.h HEADERS += frmmain.h +SOURCES += frmmain.cpp FORMS += frmmain.ui RESOURCES += other/qss.qrc RESOURCES += other/main.qrc diff --git a/videopanel/videopanel.cpp b/videopanel/videopanel.cpp index 935ba96..1beebc4 100644 --- a/videopanel/videopanel.cpp +++ b/videopanel/videopanel.cpp @@ -64,11 +64,13 @@ void VideoPanel::initControl() void VideoPanel::initForm() { //设置样式表 +#ifndef no_style QStringList qss; qss.append("QFrame{border:2px solid #000000;}"); qss.append("QLabel{font:75 25px;color:#F0F0F0;border:2px solid #AAAAAA;background:#303030;}"); qss.append("QLabel:focus{border:2px solid #00BB9E;background:#555555;}"); this->setStyleSheet(qss.join("")); +#endif videoMax = false; videoCount = 64; diff --git a/videowidget/videowidget.cpp b/videowidget/videowidget.cpp index dd30206..f895490 100644 --- a/videowidget/videowidget.cpp +++ b/videowidget/videowidget.cpp @@ -100,8 +100,8 @@ void VideoWidget::initFlowPanel() icons << QApplication::style()->standardIcon(QStyle::SP_DialogOkButton); icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); #else - QList chars; - chars << QChar(0xe68d) << QChar(0xe672) << QChar(0xe674) << QChar(0xea36) << QChar(0xe74c); + QList icons; + icons << 0xe68d << 0xe672 << 0xe674 << 0xea36 << 0xe74c; //判断图形字体是否存在,不存在则加入 QFont iconFont; @@ -143,7 +143,7 @@ void VideoWidget::initFlowPanel() btn->setIcon(icons.at(i)); #else btn->setFont(iconFont); - btn->setText(chars.at(i)); + btn->setText((QChar)icons.at(i)); #endif //将按钮加到布局中