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
|
||||
|
||||
32
client/gui/props/BlackholePropertySection.h
Normal file
32
client/gui/props/BlackholePropertySection.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "props/PropertySectionWidget.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QLabel;
|
||||
|
||||
namespace gui {
|
||||
|
||||
struct BlackholePropertyUiState {
|
||||
QString blackholeName;
|
||||
QString statusText;
|
||||
QString methodText;
|
||||
};
|
||||
|
||||
class BlackholePropertySection final : public PropertySectionWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackholePropertySection(QWidget* parent = nullptr);
|
||||
|
||||
void clearDisconnected();
|
||||
void applyState(const BlackholePropertyUiState& s);
|
||||
|
||||
private:
|
||||
QLabel* m_name = nullptr;
|
||||
QLabel* m_status = nullptr;
|
||||
QLabel* m_method = nullptr;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
@@ -40,13 +40,15 @@ EntityPropertySection::EntityPropertySection(QWidget* parent)
|
||||
form->addRow(QStringLiteral("深度"), m_depth);
|
||||
form->addRow(QStringLiteral("距离缩放"), m_distScale);
|
||||
|
||||
m_pivotLabel = new QLabel(QStringLiteral("中心坐标"), this);
|
||||
m_pivot = new Vec2ParamControl(this);
|
||||
m_pivot->setToolTip(QStringLiteral("枢轴在世界坐标中的位置(限制在轮廓包络内),用于重定位局部原点"));
|
||||
form->addRow(QStringLiteral("中心坐标"), m_pivot);
|
||||
form->addRow(m_pivotLabel, m_pivot);
|
||||
|
||||
m_centroidLabel = new QLabel(QStringLiteral("位置"), this);
|
||||
m_centroid = new Vec2ParamControl(this);
|
||||
m_centroid->setToolTip(QStringLiteral("实体几何质心的世界坐标;修改将整体平移实体"));
|
||||
form->addRow(QStringLiteral("位置"), m_centroid);
|
||||
form->addRow(m_centroidLabel, m_centroid);
|
||||
|
||||
m_userScale = new QDoubleSpinBox(this);
|
||||
m_userScale->setRange(0.05, 20.0);
|
||||
@@ -190,6 +192,14 @@ void EntityPropertySection::clearDisconnected() {
|
||||
if (m_distScale) m_distScale->setText(QStringLiteral("-"));
|
||||
if (m_pivot) m_pivot->setValue(0.0, 0.0);
|
||||
if (m_centroid) m_centroid->setValue(0.0, 0.0);
|
||||
if (m_pivotLabel) m_pivotLabel->setText(QStringLiteral("中心坐标"));
|
||||
if (m_centroidLabel) m_centroidLabel->setText(QStringLiteral("位置"));
|
||||
if (m_pivot) {
|
||||
m_pivot->setToolTip(QStringLiteral("枢轴在世界坐标中的位置(限制在轮廓包络内),用于重定位局部原点"));
|
||||
}
|
||||
if (m_centroid) {
|
||||
m_centroid->setToolTip(QStringLiteral("实体几何质心的世界坐标;修改将整体平移实体"));
|
||||
}
|
||||
if (m_userScale) {
|
||||
m_userScale->blockSignals(true);
|
||||
m_userScale->setValue(1.0);
|
||||
@@ -239,6 +249,24 @@ void EntityPropertySection::applyState(const EntityPropertyUiState& s) {
|
||||
}
|
||||
if (m_depth) m_depth->setText(QString::number(s.depthZ));
|
||||
if (m_distScale) m_distScale->setText(s.distanceScaleText);
|
||||
if (m_pivotLabel) {
|
||||
m_pivotLabel->setText(QStringLiteral("中心坐标"));
|
||||
}
|
||||
if (m_centroidLabel) {
|
||||
m_centroidLabel->setText(QStringLiteral("位置"));
|
||||
}
|
||||
if (m_pivot) {
|
||||
m_pivot->setToolTip(
|
||||
s.parentRelativeMode
|
||||
? QStringLiteral("枢轴相对父对象的坐标;修改将写入相对父对象的位置关键帧")
|
||||
: QStringLiteral("枢轴在世界坐标中的位置(限制在轮廓包络内),用于重定位局部原点"));
|
||||
}
|
||||
if (m_centroid) {
|
||||
m_centroid->setToolTip(
|
||||
s.parentRelativeMode
|
||||
? QStringLiteral("几何质心相对父对象的坐标;修改将写入相对父对象的位置关键帧")
|
||||
: QStringLiteral("实体几何质心的世界坐标;修改将整体平移实体"));
|
||||
}
|
||||
if (m_pivot) m_pivot->setValue(s.pivot.x(), s.pivot.y());
|
||||
if (m_centroid) m_centroid->setValue(s.centroid.x(), s.centroid.y());
|
||||
if (m_userScale) {
|
||||
|
||||
@@ -32,6 +32,7 @@ struct EntityPropertyUiState {
|
||||
double userScale = 1.0;
|
||||
bool ignoreDistanceScale = false;
|
||||
bool visible = true;
|
||||
bool parentRelativeMode = false;
|
||||
core::EntityIntroContent intro;
|
||||
};
|
||||
|
||||
@@ -66,6 +67,8 @@ private:
|
||||
QLineEdit* m_name = nullptr;
|
||||
QLabel* m_depth = nullptr;
|
||||
QLabel* m_distScale = nullptr;
|
||||
QLabel* m_pivotLabel = nullptr;
|
||||
QLabel* m_centroidLabel = nullptr;
|
||||
Vec2ParamControl* m_pivot = nullptr;
|
||||
Vec2ParamControl* m_centroid = nullptr;
|
||||
QDoubleSpinBox* m_userScale = nullptr;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#include "props/ToolPropertySection.h"
|
||||
|
||||
#include "params/ParamControls.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
@@ -26,6 +29,11 @@ ToolPropertySection::ToolPropertySection(QWidget* parent)
|
||||
m_text->setPlaceholderText(QStringLiteral("对话内容…"));
|
||||
form->addRow(QStringLiteral("文字"), m_text);
|
||||
|
||||
m_positionLabel = new QLabel(QStringLiteral("位置"), this);
|
||||
m_position = new Vec2ParamControl(this);
|
||||
m_position->setToolTip(QStringLiteral("工具在世界坐标中的位置"));
|
||||
form->addRow(m_positionLabel, m_position);
|
||||
|
||||
m_pointerT = new QSlider(Qt::Horizontal, this);
|
||||
m_pointerT->setRange(0, 1000);
|
||||
m_pointerT->setSingleStep(10);
|
||||
@@ -46,7 +54,7 @@ ToolPropertySection::ToolPropertySection(QWidget* parent)
|
||||
|
||||
m_visible = new QCheckBox(QString(), this);
|
||||
m_visible->setChecked(true);
|
||||
m_visible->setToolTip(QStringLiteral("随帧变化:在当前帧切换会写入可见性关键帧(10帧淡入淡出)"));
|
||||
m_visible->setToolTip(QStringLiteral("随帧变化:在当前帧切换会写入可见性关键帧"));
|
||||
form->addRow(QStringLiteral("可见性"), m_visible);
|
||||
|
||||
lay->addLayout(form);
|
||||
@@ -58,11 +66,13 @@ ToolPropertySection::ToolPropertySection(QWidget* parent)
|
||||
connect(m_pointerT, &QSlider::valueChanged, this, &ToolPropertySection::pointerTChanged);
|
||||
connect(m_fontPx, qOverload<int>(&QSpinBox::valueChanged), this, &ToolPropertySection::fontPxChanged);
|
||||
connect(m_align, qOverload<int>(&QComboBox::currentIndexChanged), this, &ToolPropertySection::alignChanged);
|
||||
connect(m_position, &Vec2ParamControl::valueChanged, this, &ToolPropertySection::positionEdited);
|
||||
connect(m_visible, &QCheckBox::toggled, this, &ToolPropertySection::visibleToggled);
|
||||
}
|
||||
|
||||
void ToolPropertySection::setEditingEnabled(bool on) {
|
||||
for (auto* w : {static_cast<QWidget*>(m_text), static_cast<QWidget*>(m_pointerT),
|
||||
for (auto* w : {static_cast<QWidget*>(m_text), static_cast<QWidget*>(m_position),
|
||||
static_cast<QWidget*>(m_pointerT),
|
||||
static_cast<QWidget*>(m_fontPx), static_cast<QWidget*>(m_align),
|
||||
static_cast<QWidget*>(m_visible)}) {
|
||||
if (w) w->setEnabled(on);
|
||||
@@ -76,6 +86,13 @@ void ToolPropertySection::clearDisconnected() {
|
||||
m_text->clear();
|
||||
m_text->blockSignals(false);
|
||||
}
|
||||
if (m_positionLabel) m_positionLabel->setText(QStringLiteral("位置"));
|
||||
if (m_position) {
|
||||
m_position->blockSignals(true);
|
||||
m_position->setToolTip(QStringLiteral("工具在世界坐标中的位置"));
|
||||
m_position->setValue(0.0, 0.0);
|
||||
m_position->blockSignals(false);
|
||||
}
|
||||
if (m_pointerT) {
|
||||
m_pointerT->blockSignals(true);
|
||||
m_pointerT->setValue(500);
|
||||
@@ -105,6 +122,18 @@ void ToolPropertySection::applyState(const ToolPropertyUiState& s) {
|
||||
m_text->setText(s.text);
|
||||
m_text->blockSignals(false);
|
||||
}
|
||||
if (m_positionLabel) {
|
||||
m_positionLabel->setText(QStringLiteral("位置"));
|
||||
}
|
||||
if (m_position) {
|
||||
m_position->blockSignals(true);
|
||||
m_position->setToolTip(
|
||||
s.parentRelativeMode
|
||||
? QStringLiteral("工具相对父对象的位置;修改将写入相对父对象的位置关键帧")
|
||||
: QStringLiteral("工具在世界坐标中的位置"));
|
||||
m_position->setValue(s.position.x(), s.position.y());
|
||||
m_position->blockSignals(false);
|
||||
}
|
||||
if (m_pointerT) {
|
||||
m_pointerT->blockSignals(true);
|
||||
m_pointerT->setValue(std::clamp(s.pointerTThousandths, 0, 1000));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "props/PropertySectionWidget.h"
|
||||
|
||||
#include <QPointF>
|
||||
#include <QString>
|
||||
|
||||
class QComboBox;
|
||||
@@ -9,12 +10,19 @@ class QLineEdit;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
|
||||
namespace gui {
|
||||
class Vec2ParamControl;
|
||||
}
|
||||
|
||||
namespace gui {
|
||||
|
||||
struct ToolPropertyUiState {
|
||||
QString displayName;
|
||||
QString text;
|
||||
QPointF position;
|
||||
bool parentRelativeMode = false;
|
||||
int pointerTThousandths = 500; // bubblePointerT01 * 1000,0=左 1000=右
|
||||
int fontPx = 18;
|
||||
int alignIndex = 1; // 0=left,1=center,2=right
|
||||
@@ -35,10 +43,13 @@ signals:
|
||||
void pointerTChanged(int thousandths);
|
||||
void fontPxChanged(int px);
|
||||
void alignChanged(int alignIndex);
|
||||
void positionEdited(double x, double y);
|
||||
// 可见性(动画通道):在当前帧写关键帧
|
||||
void visibleToggled(bool on);
|
||||
|
||||
private:
|
||||
QLabel* m_positionLabel = nullptr;
|
||||
Vec2ParamControl* m_position = nullptr;
|
||||
QLineEdit* m_text = nullptr;
|
||||
QSlider* m_pointerT = nullptr;
|
||||
QSpinBox* m_fontPx = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user