update
This commit is contained in:
45
client/gui/props/BlackholePropertySection.cpp
Normal file
45
client/gui/props/BlackholePropertySection.cpp
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user