添加模型分割
This commit is contained in:
56
client/gui/dialogs/EntityFinalizeDialog.cpp
Normal file
56
client/gui/dialogs/EntityFinalizeDialog.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "dialogs/EntityFinalizeDialog.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
EntityFinalizeDialog::EntityFinalizeDialog(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
setWindowTitle(QStringLiteral("确认实体"));
|
||||
setModal(true);
|
||||
|
||||
auto* root = new QVBoxLayout(this);
|
||||
auto* form = new QFormLayout();
|
||||
|
||||
m_name = new QLineEdit(this);
|
||||
m_name->setPlaceholderText(QStringLiteral("例如:entity-1、人物、树、建筑…"));
|
||||
form->addRow(QStringLiteral("名称"), m_name);
|
||||
|
||||
m_userScale = new QDoubleSpinBox(this);
|
||||
m_userScale->setDecimals(3);
|
||||
m_userScale->setRange(0.01, 50.0);
|
||||
m_userScale->setSingleStep(0.05);
|
||||
form->addRow(QStringLiteral("整体缩放"), m_userScale);
|
||||
|
||||
root->addLayout(form);
|
||||
|
||||
auto* btns = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
connect(btns, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(btns, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
root->addWidget(btns);
|
||||
}
|
||||
|
||||
void EntityFinalizeDialog::setDefaultName(const QString& name) {
|
||||
if (m_name) {
|
||||
m_name->setText(name);
|
||||
m_name->selectAll();
|
||||
m_name->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
QString EntityFinalizeDialog::name() const {
|
||||
return m_name ? m_name->text().trimmed() : QString();
|
||||
}
|
||||
|
||||
void EntityFinalizeDialog::setUserScale(double s) {
|
||||
if (m_userScale) {
|
||||
m_userScale->setValue(s);
|
||||
}
|
||||
}
|
||||
|
||||
double EntityFinalizeDialog::userScale() const {
|
||||
return m_userScale ? m_userScale->value() : 1.0;
|
||||
}
|
||||
|
||||
24
client/gui/dialogs/EntityFinalizeDialog.h
Normal file
24
client/gui/dialogs/EntityFinalizeDialog.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QLineEdit;
|
||||
class QDoubleSpinBox;
|
||||
|
||||
/// 实体落盘前的确认对话框:命名 + 常用属性调整。
|
||||
class EntityFinalizeDialog final : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EntityFinalizeDialog(QWidget* parent = nullptr);
|
||||
|
||||
void setDefaultName(const QString& name);
|
||||
QString name() const;
|
||||
|
||||
void setUserScale(double s);
|
||||
double userScale() const;
|
||||
|
||||
private:
|
||||
QLineEdit* m_name = nullptr;
|
||||
QDoubleSpinBox* m_userScale = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user