diff --git a/CellFrameDashboardService/DapChainHistoryHandler.cpp b/CellFrameDashboardService/DapChainHistoryHandler.cpp index 136e34841e8ccff176082c7511a2ddf149e8c854..71c10a7faeb09681ecbd3bde6c78a496e78c036c 100644 --- a/CellFrameDashboardService/DapChainHistoryHandler.cpp +++ b/CellFrameDashboardService/DapChainHistoryHandler.cpp @@ -29,14 +29,20 @@ void DapChainHistoryHandler::onRequestNewHistory(const QMap<QString, QVariant>& if(!result.isEmpty()) { - QRegExp rx("((\\w{3}\\s+){2}\\d{1,2}\\s+(\\d{1,2}:*){3}\\s+\\d{4})\\s+(\\w+)\\s+(\\d+)\\s(\\w+)\\s+\\w+\\s+([\\w\\d]+)"); - - int pos = 0; - while ((pos = rx.indexIn(result, pos)) != -1) + QRegularExpression regular("((\\w{3}\\s+){2}\\d{1,2}\\s+(\\d{1,2}:*){3}\\s+\\d{4})\\s+(\\w+)\\s+(\\d+)\\s(\\w+)\\s+\\w+\\s+([\\w\\d]+)", QRegularExpression::MultilineOption); + QRegularExpressionMatchIterator matchItr = regular.globalMatch(result); + while (matchItr.hasNext()) { - QStringList dataItem = QStringList() << rx.cap(1) << QString::number(DapTransactionStatusConvertor::getStatusByShort(rx.cap(4))) << rx.cap(5) << rx.cap(6) << rx.cap(7) << wallets.at(i).toString(); + QRegularExpressionMatch match = matchItr.next(); + QStringList dataItem = QStringList() + << match.captured(1) + << QString::number(DapTransactionStatusConvertor::getStatusByShort(match.captured(4))) + << match.captured(5) + << match.captured(6) + << match.captured(7) + << wallets.at(i).toString(); data << dataItem; - pos += rx.matchedLength(); + } } } diff --git a/CellFrameDashboardService/DapChainHistoryHandler.h b/CellFrameDashboardService/DapChainHistoryHandler.h index 6b56f6e35801057ea3d67c547cc0e64d7b904feb..61b45dfb4f1b9ee5b6b6dfebcc84df9ce3709d87 100644 --- a/CellFrameDashboardService/DapChainHistoryHandler.h +++ b/CellFrameDashboardService/DapChainHistoryHandler.h @@ -8,6 +8,7 @@ #include <QProcess> #include <QDebug> #include <QList> +#include <QRegularExpression> #include "DapHistoryType.h"