Ai
1 Star 2 Fork 142

Qt(开源集合)/DS

forked from Vanishi/DS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mCustomtaskSmartalertXpath.cpp 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
#include "mCustomtaskSmartalertXpath.h"
#include "style.h"
#include <QLabel>
#include <QHBoxLayout>
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
#include <QtCore5Compat>
#endif
MCustomTaskSmartAlertXPath::MCustomTaskSmartAlertXPath(QWidget *parent) : QWidget(parent)
{
boxLayout = new QHBoxLayout(this);
boxLayout->setContentsMargins(6,0,0,6);
xpathLabel = new QLabel(this);
xpathLabel->setCursor(Qt::PointingHandCursor);
xpathLabel->setStyleSheet(m_stylesheet_QLabel14);
boxLayout->addWidget(xpathLabel);
setLayout(boxLayout);
}
void MCustomTaskSmartAlertXPath::setXpath(const QString &xpath){
if(""==xpath){
xpathLabel->setText(xpath);
}else{
QString x = xpath;
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
x.replace(QRegularExpression("\\[\\d+\\]"),"");
#else
x.replace(QRegExp("\\[\\d+\\]"),"");
#endif
x.replace("/html/body/","");
QStringList xs = x.split("/");
QStringList xsReal;
int end = xs.length();
if (end >6){
int start = end - 6;
for (int i = start; i < end; ++i) {
xsReal.append(xs[i]);
}
}else{
xsReal = xs;
}
xpathLabel->setText(">>"+xsReal.join("/"));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qt-open-source-collection/DS.git
git@gitee.com:qt-open-source-collection/DS.git
qt-open-source-collection
DS
DS
master

搜索帮助