Files
hfut-bishe/client/gui/props/EntityPropertySection.h

90 lines
2.4 KiB
C++

#pragma once
#include "core/domain/EntityIntro.h"
#include "props/PropertySectionWidget.h"
#include <QPointF>
#include <QString>
class QLabel;
class QLineEdit;
class QDoubleSpinBox;
class QCheckBox;
class QTextEdit;
class QListWidget;
class QPushButton;
class QToolButton;
class QTimer;
class QWidget;
namespace gui {
class Vec2ParamControl;
}
namespace gui {
struct EntityPropertyUiState {
QString displayName;
int depthZ = 0;
QString distanceScaleText;
QPointF pivot;
QPointF centroid;
double userScale = 1.0;
bool ignoreDistanceScale = false;
bool visible = true;
core::EntityIntroContent intro;
};
// 实体相关属性(可嵌入 QStackedWidget 的一页)
class EntityPropertySection final : public PropertySectionWidget {
Q_OBJECT
public:
explicit EntityPropertySection(QWidget* parent = nullptr);
void clearDisconnected();
void applyState(const EntityPropertyUiState& s);
void setEditingEnabled(bool on);
[[nodiscard]] core::EntityIntroContent introSnapshot() const;
void appendIntroImagePath(const QString& relativePath);
signals:
void displayNameCommitted(const QString& text);
void pivotEdited(double x, double y);
void centroidEdited(double x, double y);
void userScaleEdited(double value);
void ignoreDistanceScaleToggled(bool on);
// 可见性(动画通道):在当前帧写关键帧
void visibleToggled(bool on);
/// 介绍字段变更后防抖触发,由主窗口写入工程
void introContentEdited();
void introAddImageRequested();
private:
void scheduleIntroPersist();
void setIntroSectionExpanded(bool expanded);
QLineEdit* m_name = nullptr;
QLabel* m_depth = nullptr;
QLabel* m_distScale = nullptr;
Vec2ParamControl* m_pivot = nullptr;
Vec2ParamControl* m_centroid = nullptr;
QDoubleSpinBox* m_userScale = nullptr;
QCheckBox* m_ignoreDistanceScale = nullptr;
QCheckBox* m_visible = nullptr;
QLineEdit* m_introTitle = nullptr;
QTextEdit* m_introBody = nullptr;
QLineEdit* m_introVideo = nullptr;
QListWidget* m_introImages = nullptr;
QPushButton* m_btnIntroAddImage = nullptr;
QPushButton* m_btnIntroRemoveImage = nullptr;
QWidget* m_introHeader = nullptr;
QToolButton* m_introToggle = nullptr;
QWidget* m_introContent = nullptr;
QTimer* m_introSaveTimer = nullptr;
bool m_introBulkUpdate = false;
};
} // namespace gui