This commit is contained in:
2026-04-09 23:13:33 +08:00
parent d67d7dc0c5
commit 6cb82cec57
24 changed files with 1733 additions and 71 deletions

View File

@@ -0,0 +1,45 @@
#include "props/BlackholePropertySection.h"
#include <QFormLayout>
#include <QLabel>
#include <QVBoxLayout>
namespace gui {
BlackholePropertySection::BlackholePropertySection(QWidget* parent)
: PropertySectionWidget(parent) {
auto* lay = new QVBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(6);
auto* form = new QFormLayout();
form->setContentsMargins(0, 0, 0, 0);
form->setSpacing(6);
m_name = new QLabel(this);
m_status = new QLabel(this);
m_method = new QLabel(this);
m_method->setWordWrap(true);
form->addRow(QStringLiteral("黑洞"), m_name);
form->addRow(QStringLiteral("是否解决"), m_status);
form->addRow(QStringLiteral("解决方案"), m_method);
lay->addLayout(form);
lay->addStretch(1);
}
void BlackholePropertySection::clearDisconnected() {
if (m_name) m_name->setText(QStringLiteral("-"));
if (m_status) m_status->setText(QStringLiteral("-"));
if (m_method) m_method->setText(QStringLiteral("-"));
}
void BlackholePropertySection::applyState(const BlackholePropertyUiState& s) {
if (m_name) m_name->setText(s.blackholeName.isEmpty() ? QStringLiteral("-") : s.blackholeName);
if (m_status) m_status->setText(s.statusText.isEmpty() ? QStringLiteral("-") : s.statusText);
if (m_method) m_method->setText(s.methodText.isEmpty() ? QStringLiteral("-") : s.methodText);
}
} // namespace gui