代码拉取完成,页面将自动刷新
#include "scriptcenterwindow.h"
#include <DTextBrowser>
#include <DTreeWidget>
#include <QHBoxLayout>
ScriptCenterWindow::ScriptCenterWindow(DMainWindow *parent) : DDialog(parent) {
setMinimumSize(700, 500);
setWindowTitle(tr("ScriptCenter"));
auto w = new QWidget(this);
auto layout = new QHBoxLayout(w);
auto tree = new QTreeWidget(this);
tree->setHeaderHidden(true);
m = ScriptManager::instance();
m->loadTreeWidget(tree);
layout->addWidget(tree);
auto txt = new QTextBrowser(this);
layout->addWidget(txt);
addContent(w);
connect(tree, &QTreeWidget::itemSelectionChanged, this, [=] {
auto s = tree->selectedItems();
if (s.count()) {
auto si = s.first();
auto meta = si->data(0, Qt::UserRole).value<ScriptMeta>();
if (meta.name.length()) {
txt->setMarkdown(QString("**%1** : %2\n\n**%3** : %4\n\n"
"**%5** : %6\n\n**%7** : %8\n\n"
"**%9** : %10\n\n")
.arg(tr("Name"))
.arg(meta.name)
.arg(tr("Author"))
.arg(meta.author)
.arg(tr("License"))
.arg(meta.license)
.arg("Version")
.arg(meta.version)
.arg("Commnet")
.arg(meta.commnet));
} else {
txt->setMarkdown(
QString("**%1** : %2\n\n").arg(tr("Catagory")).arg(si->text(0)));
}
}
});
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。