diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts
index 47e41ac9..1602e815 100644
--- a/src/translations/Dyt_zh_CN.ts
+++ b/src/translations/Dyt_zh_CN.ts
@@ -831,12 +831,12 @@
-
+
ModelBase
-
+
color base
@@ -911,12 +911,12 @@
QtBoolPropertyManager
-
+
True
-
+
False
@@ -940,22 +940,22 @@
QtColorPropertyManager
-
+
Red
-
+
Green
-
+
Blue
-
+
Alpha
@@ -963,43 +963,43 @@
QtConeWaveComponentManager
-
-
+
+
ConeWaveComponent
-
+
Height
-
+
Radius
-
+
levelCount
-
+
levelHeight
-
+
Color1
-
+
Color2
-
+
Color3
@@ -1105,28 +1105,28 @@
QtDashedLineComponentManager
-
-
+
+
DashedLineComponent
-
+
Start
-
+
End
-
+
Radius
-
+
Color
@@ -1142,12 +1142,12 @@
QtEntityPropertyManager
-
+
Name
-
+
Transform
@@ -1168,37 +1168,37 @@
QtFontPropertyManager
-
+
Family
-
+
Point Size
-
+
Bold
-
+
Italic
-
+
Underline
-
+
Strikeout
-
+
Kerning
@@ -1206,22 +1206,22 @@
QtLocalePropertyManager
-
+
<Invalid>
-
+
%1, %2
-
+
Language
-
+
Country
@@ -1229,13 +1229,13 @@
QtMeshComponetManager
-
-
+
+
MeshComponent
-
+
Mesh
@@ -1243,22 +1243,22 @@
QtModelBasePropertyManager
-
+
Name
-
+
Description
-
+
Inflow
-
+
InnerBottomElevation
@@ -1279,13 +1279,13 @@
QtPathComponentManager
-
-
+
+
PathComponent
-
+
Path
@@ -1293,17 +1293,17 @@
QtPointFPropertyManager
-
+
(%1, %2)
-
+
X
-
+
Y
@@ -1311,17 +1311,17 @@
QtPointPropertyManager
-
+
(%1, %2)
-
+
X
-
+
Y
@@ -1339,12 +1339,12 @@
-
+
[%1, %2, %3]
-
+
[%1, %2, %3] [%4, %5, %6] [%7, %8, %9]
@@ -1352,27 +1352,27 @@
QtRectFPropertyManager
-
+
[(%1, %2), %3 x %4]
-
+
X
-
+
Y
-
+
Width
-
+
Height
@@ -1380,27 +1380,27 @@
QtRectPropertyManager
-
+
[(%1, %2), %3 x %4]
-
+
X
-
+
Y
-
+
Width
-
+
Height
@@ -1408,17 +1408,17 @@
QtSizeFPropertyManager
-
+
%1 x %2
-
+
Width
-
+
Height
@@ -1426,33 +1426,33 @@
QtSizePolicyPropertyManager
-
-
+
+
<Invalid>
-
+
[%1, %2, %3, %4]
-
+
Horizontal Policy
-
+
Vertical Policy
-
+
Horizontal Stretch
-
+
Vertical Stretch
@@ -1460,17 +1460,17 @@
QtSizePropertyManager
-
+
%1 x %2
-
+
Width
-
+
Height
@@ -1486,17 +1486,17 @@
QtTransfromPropertyManager
-
+
Location
-
+
Rotation
-
+
Scale
@@ -1517,17 +1517,17 @@
QtVec3PropertyManager
-
+
X
-
+
Y
-
+
Z
@@ -1535,17 +1535,17 @@
QtWorkspacePropertyManager
-
+
Name
-
+
Description
-
+
Timestep
diff --git a/src/ui/PropertyBrowser.cpp b/src/ui/PropertyBrowser.cpp
index 7ac02590..5aeb557c 100644
--- a/src/ui/PropertyBrowser.cpp
+++ b/src/ui/PropertyBrowser.cpp
@@ -129,6 +129,7 @@ void PropertyBrowser::InitPropertyManager() {
QtSpinBoxFactory* spinBoxFactory = new QtSpinBoxFactory(this);
QtLineEditFactory* lineEditFactory = new QtLineEditFactory(this);
QtEnumEditorFactory* comboBoxFactory = new QtEnumEditorFactory(this);
+ QtFilePathFactory* filePathFactory = new QtFilePathFactory(this);
//QtTransfromEditorFactory* transformFactory = new QtTransfromEditorFactory(this);
browser_->setFactoryForManager(doubleManager_, doubleSpinBoxFactory);
@@ -140,6 +141,7 @@ void PropertyBrowser::InitPropertyManager() {
browser_->setFactoryForManager(pointManager_->subIntPropertyManager(), spinBoxFactory);
browser_->setFactoryForManager(sizeManager_->subIntPropertyManager(), spinBoxFactory);
browser_->setFactoryForManager(workSpaceManager_->subStringProperyManager(), lineEditFactory);
+ browser_->setFactoryForManager(workSpaceManager_->subFilesProperyManager(), filePathFactory);
browser_->setFactoryForManager(entityManager_->subStringProperyManager(), lineEditFactory);
browser_->setFactoryForManager(
entityManager_->subTransfromProperyManager()->subVec3TPropertyManager()->subDoublePropertyManager(),
@@ -166,7 +168,7 @@ void PropertyBrowser::InitComponentPropertyManager() {
componetManager_[meshComponentManager->GetPropertyId()] = meshComponentManager;
QtPathComponentManager* pathComponentManager = new QtPathComponentManager(this);
- browser_->setFactoryForManager(pathComponentManager->subStringProperyManager(), filePathFactory);
+ browser_->setFactoryForManager(pathComponentManager->subFilesProperyManager(), filePathFactory);
componetManager_[pathComponentManager->GetPropertyId()] = pathComponentManager;
QtConeWaveComponentManager* coneWaveComponentManager = new QtConeWaveComponentManager(this);
diff --git a/src/ui/PropertyBrowser/qteditorfactory.cpp b/src/ui/PropertyBrowser/qteditorfactory.cpp
index 06bd1a25..27fd60d0 100644
--- a/src/ui/PropertyBrowser/qteditorfactory.cpp
+++ b/src/ui/PropertyBrowser/qteditorfactory.cpp
@@ -1088,7 +1088,7 @@ void QtFilePathFactoryPrivate::slotSetValue(const QString& value)
for (QMap::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty* property = itEditor.value();
- QtStringPropertyManager* manager = q_ptr->propertyManager(property);
+ QtFilesPropertyManager* manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
@@ -1112,7 +1112,7 @@ void QtFilePathFactoryPrivate::slotSetValue(const QString& value)
Creates a factory with the given \a parent.
*/
QtFilePathFactory::QtFilePathFactory(QObject* parent)
- : QtAbstractEditorFactory(parent), d_ptr(new QtFilePathFactoryPrivate())
+ : QtAbstractEditorFactory(parent), d_ptr(new QtFilePathFactoryPrivate())
{
d_ptr->q_ptr = this;
@@ -1131,7 +1131,7 @@ QtFilePathFactory::~QtFilePathFactory()
Reimplemented from the QtAbstractEditorFactory class.
*/
-void QtFilePathFactory::connectPropertyManager(QtStringPropertyManager* manager)
+void QtFilePathFactory::connectPropertyManager(QtFilesPropertyManager* manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotPropertyChanged(QtProperty*, QString)));
@@ -1142,7 +1142,7 @@ void QtFilePathFactory::connectPropertyManager(QtStringPropertyManager* manager)
Reimplemented from the QtAbstractEditorFactory class.
*/
-QWidget* QtFilePathFactory::createEditor(QtStringPropertyManager* manager,
+QWidget* QtFilePathFactory::createEditor(QtFilesPropertyManager* manager,
QtProperty* property, QWidget* parent)
{
QFilePathEdit* editor = d_ptr->createEditor(property, parent);
@@ -1163,7 +1163,7 @@ QWidget* QtFilePathFactory::createEditor(QtStringPropertyManager* manager,
Reimplemented from the QtAbstractEditorFactory class.
*/
-void QtFilePathFactory::disconnectPropertyManager(QtStringPropertyManager* manager)
+void QtFilePathFactory::disconnectPropertyManager(QtFilesPropertyManager* manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotPropertyChanged(QtProperty*, QString)));
diff --git a/src/ui/PropertyBrowser/qteditorfactory.h b/src/ui/PropertyBrowser/qteditorfactory.h
index c10068b0..b6c84b0e 100644
--- a/src/ui/PropertyBrowser/qteditorfactory.h
+++ b/src/ui/PropertyBrowser/qteditorfactory.h
@@ -190,17 +190,17 @@ private:
class QtFilePathFactoryPrivate;
-class QtFilePathFactory : public QtAbstractEditorFactory
+class QtFilePathFactory : public QtAbstractEditorFactory
{
Q_OBJECT
public:
QtFilePathFactory(QObject *parent = 0);
~QtFilePathFactory();
protected:
- void connectPropertyManager(QtStringPropertyManager *manager) override;
- QWidget *createEditor(QtStringPropertyManager *manager, QtProperty *property,
+ void connectPropertyManager(QtFilesPropertyManager*manager) override;
+ QWidget *createEditor(QtFilesPropertyManager*manager, QtProperty *property,
QWidget *parent) override;
- void disconnectPropertyManager(QtStringPropertyManager *manager) override;
+ void disconnectPropertyManager(QtFilesPropertyManager*manager) override;
private:
QScopedPointer d_ptr;
Q_DECLARE_PRIVATE(QtFilePathFactory)
diff --git a/src/ui/PropertyBrowser/qtpropertymanager.cpp b/src/ui/PropertyBrowser/qtpropertymanager.cpp
index 858badbc..38b54b3b 100644
--- a/src/ui/PropertyBrowser/qtpropertymanager.cpp
+++ b/src/ui/PropertyBrowser/qtpropertymanager.cpp
@@ -1533,6 +1533,176 @@ void QtStringPropertyManager::uninitializeProperty(QtProperty* property)
#pragma endregion
+// QtFilesPropertyManager
+#pragma region QtFilesPropertyManager
+
+class QtFilesPropertyManagerPrivate {
+ QtFilesPropertyManager* q_ptr;
+ Q_DECLARE_PUBLIC(QtFilesPropertyManager)
+public:
+
+ struct Data {
+ QString val;
+ QString initVal;
+ bool isInitialed;
+ };
+
+ typedef QMap PropertyValueMap;
+ QMap m_values;
+};
+
+/*!
+ \class QtStringPropertyManager
+ \internal
+ \inmodule QtDesigner
+ \since 4.4
+
+ \brief The QtStringPropertyManager provides and manages QString properties.
+
+ A string property's value can be retrieved using the value()
+ function, and set using the setValue() slot.
+
+ The current value can be checked against a regular expression. To
+ set the regular expression use the setRegExp() slot, use the
+ regExp() function to retrieve the currently set expression.
+
+ In addition, QtStringPropertyManager provides the valueChanged() signal
+ which is emitted whenever a property created by this manager
+ changes, and the regExpChanged() signal which is emitted whenever
+ such a property changes its currently set regular expression.
+
+ \sa QtAbstractPropertyManager, QtLineEditFactory
+*/
+
+/*!
+ \fn void QtStringPropertyManager::valueChanged(QtProperty *property, const QString &value)
+
+ This signal is emitted whenever a property created by this manager
+ changes its value, passing a pointer to the \a property and the
+ new \a value as parameters.
+
+ \sa setValue()
+*/
+
+/*!
+ \fn void QtStringPropertyManager::regExpChanged(QtProperty *property, const QRegularExpression ®Exp)
+
+ This signal is emitted whenever a property created by this manager
+ changes its currenlty set regular expression, passing a pointer to
+ the \a property and the new \a regExp as parameters.
+
+ \sa setRegExp()
+*/
+
+/*!
+ Creates a manager with the given \a parent.
+*/
+QtFilesPropertyManager::QtFilesPropertyManager(QObject* parent)
+ : QtAbstractPropertyManager(parent), d_ptr(new QtFilesPropertyManagerPrivate) {
+ d_ptr->q_ptr = this;
+}
+
+/*!
+ Destroys this manager, and all the properties it has created.
+*/
+QtFilesPropertyManager::~QtFilesPropertyManager() {
+ clear();
+}
+
+/*!
+ Returns the given \a property's value.
+
+ If the given property is not managed by this manager, this
+ function returns an empty string.
+
+ \sa setValue()
+*/
+QString QtFilesPropertyManager::value(const QtProperty* property) const {
+ return getValue(d_ptr->m_values, property);
+}
+
+QString QtFilesPropertyManager::initialValue(const QtProperty* property) const {
+ return getData(d_ptr->m_values, &QtFilesPropertyManagerPrivate::Data::initVal, property, QString());
+}
+
+/*!
+ \reimp
+*/
+QString QtFilesPropertyManager::valueText(const QtProperty* property) const {
+ const QtFilesPropertyManagerPrivate::PropertyValueMap::const_iterator it = d_ptr->m_values.constFind(property);
+ if (it == d_ptr->m_values.constEnd())
+ return QString();
+ return it.value().val;
+}
+
+/*!
+ \fn void QtStringPropertyManager::setValue(QtProperty *property, const QString &value)
+
+ Sets the value of the given \a property to \a value.
+
+ If the specified \a value doesn't match the given \a property's
+ regular expression, this function does nothing.
+
+ \sa value(), setRegExp(), valueChanged()
+*/
+void QtFilesPropertyManager::setValue(QtProperty* property, const QString& val) {
+ const QtFilesPropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property);
+ if (it == d_ptr->m_values.end())
+ return;
+
+ QtFilesPropertyManagerPrivate::Data data = it.value();
+
+ if (data.val == val)
+ return;
+
+ if (!data.isInitialed) {
+ data.initVal = val;
+ data.isInitialed = true;
+ }
+
+ data.val = val;
+
+ it.value() = data;
+
+ emit propertyChanged(property);
+ emit valueChanged(property, data.val);
+}
+
+void QtFilesPropertyManager::setValueOnly(QtProperty* property, const QString& val) {
+ const QtFilesPropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property);
+ if (it == d_ptr->m_values.end())
+ return;
+
+ QtFilesPropertyManagerPrivate::Data data = it.value();
+
+ if (data.val == val)
+ return;
+
+ data.val = val;
+ data.initVal = val;
+
+ it.value() = data;
+
+ emit propertyChanged(property);
+ emit valueChanged(property, data.val);
+}
+
+/*!
+ \reimp
+*/
+void QtFilesPropertyManager::initializeProperty(QtProperty* property) {
+ d_ptr->m_values[property] = QtFilesPropertyManagerPrivate::Data();
+}
+
+/*!
+ \reimp
+*/
+void QtFilesPropertyManager::uninitializeProperty(QtProperty* property) {
+ d_ptr->m_values.remove(property);
+}
+
+#pragma endregion
+
// QtBoolPropertyManager
#pragma region QtBoolPropertyManager
@@ -7530,6 +7700,7 @@ public:
QtStringPropertyManager* m_stringProperyManager;
+ QtFilesPropertyManager* m_filesProperyManager;
QMap m_properyToName;
QMap m_properyToDescription;
@@ -7578,9 +7749,11 @@ QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent)
d_ptr->q_ptr = this;
d_ptr->m_stringProperyManager = new QtStringPropertyManager(this);
- bool succ = connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
+ connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotStringChanged(QtProperty*, QString)));
- succ = false;
+ d_ptr->m_filesProperyManager = new QtFilesPropertyManager(this);
+ connect(d_ptr->m_filesProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
+ this, SLOT(slotStringChanged(QtProperty*, QString)));
}
/*!
@@ -7606,6 +7779,10 @@ QtStringPropertyManager* QtWorkspacePropertyManager::subStringProperyManager() c
return d_ptr->m_stringProperyManager;
}
+QtFilesPropertyManager* QtWorkspacePropertyManager::subFilesProperyManager() const {
+ return d_ptr->m_filesProperyManager;
+}
+
/*!
\reimp
*/
@@ -7648,7 +7825,7 @@ void QtWorkspacePropertyManager::setValue(QtProperty* property, const QWorkspace
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
- d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
+ d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
emit propertyChanged(property);
emit valueChanged(property, value);
@@ -7675,9 +7852,9 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
d_ptr->m_descriptionToPropery[prop] = property;
property->addSubProperty(prop);
- prop = d_ptr->m_stringProperyManager->addProperty();
+ prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("Timestep"));
- d_ptr->m_stringProperyManager->setValueOnly(prop, val.GetTimeStep());
+ d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetTimeStep());
d_ptr->m_properyToTimestep[property] = prop;
d_ptr->m_timestepToPropery[prop] = property;
property->addSubProperty(prop);
@@ -8095,7 +8272,7 @@ public:
typedef QMap PropertyValueMap;
PropertyValueMap m_values;
- QtStringPropertyManager* m_stringProperyManager;
+ QtFilesPropertyManager* m_filesProperyManager;
QMap m_properyToPath;
@@ -8122,8 +8299,8 @@ QtPathComponentManager::QtPathComponentManager(QObject* parent)
: QtComponentPropertyManager(parent), d_ptr(new QtPathComponentManagerPrivate) {
d_ptr->q_ptr = this;
- d_ptr->m_stringProperyManager = new QtStringPropertyManager(this);
- connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
+ d_ptr->m_filesProperyManager = new QtFilesPropertyManager(this);
+ connect(d_ptr->m_filesProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotStringChanged(QtProperty*, QString)));
}
@@ -8159,8 +8336,8 @@ QPathComponentAttribute QtPathComponentManager::value(const QtProperty* property
return d_ptr->m_values.value(property, QPathComponentAttribute());
}
-QtStringPropertyManager* QtPathComponentManager::subStringProperyManager() const {
- return d_ptr->m_stringProperyManager;
+QtFilesPropertyManager* QtPathComponentManager::subFilesProperyManager() const {
+ return d_ptr->m_filesProperyManager;
}
/*!
@@ -8203,7 +8380,7 @@ void QtPathComponentManager::setValue(QtProperty* property, const QPathComponent
it.value() = value;
- d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToPath[property], value.GetPath());
+ d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToPath[property], value.GetPath());
emit propertyChanged(property);
emit valueChanged(property, value);
@@ -8216,9 +8393,9 @@ void QtPathComponentManager::initializeProperty(QtProperty* property) {
QPathComponentAttribute val;
d_ptr->m_values[property] = val;
- QtProperty* prop = d_ptr->m_stringProperyManager->addProperty();
+ QtProperty* prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("Path"));
- d_ptr->m_stringProperyManager->setValueOnly(prop, val.GetPath());
+ d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetPath());
d_ptr->m_properyToPath[property] = prop;
d_ptr->m_pathToPropery[prop] = property;
property->addSubProperty(prop);
diff --git a/src/ui/PropertyBrowser/qtpropertymanager.h b/src/ui/PropertyBrowser/qtpropertymanager.h
index 9365a2b1..dd98c12a 100644
--- a/src/ui/PropertyBrowser/qtpropertymanager.h
+++ b/src/ui/PropertyBrowser/qtpropertymanager.h
@@ -219,6 +219,36 @@ private:
#pragma endregion
+#pragma region QtFilesPropertyManager
+
+class QtFilesPropertyManagerPrivate;
+
+class QtFilesPropertyManager : public QtAbstractPropertyManager {
+ Q_OBJECT
+public:
+ QtFilesPropertyManager(QObject* parent = 0);
+ ~QtFilesPropertyManager();
+
+ QString value(const QtProperty* property) const;
+ QString initialValue(const QtProperty* property) const;
+
+public Q_SLOTS:
+ void setValue(QtProperty* property, const QString& val);
+ void setValueOnly(QtProperty* property, const QString& val);
+Q_SIGNALS:
+ void valueChanged(QtProperty* property, const QString& val);
+protected:
+ QString valueText(const QtProperty* property) const override;
+ void initializeProperty(QtProperty* property) override;
+ void uninitializeProperty(QtProperty* property) override;
+private:
+ QScopedPointer d_ptr;
+ Q_DECLARE_PRIVATE(QtFilesPropertyManager)
+ Q_DISABLE_COPY_MOVE(QtFilesPropertyManager)
+};
+
+#pragma endregion
+
#pragma region QtDatePropertyManager
class QtDatePropertyManagerPrivate;
@@ -967,6 +997,7 @@ public:
QWorkspaceAttribute value(const QtProperty* property) const;
QtStringPropertyManager* subStringProperyManager() const;
+ QtFilesPropertyManager* subFilesProperyManager() const;
public Q_SLOTS:
void setValue(QtProperty* property, const QWorkspaceAttribute& val);
@@ -1085,7 +1116,7 @@ public:
QPathComponentAttribute value(const QtProperty* property) const;
- QtStringPropertyManager* subStringProperyManager() const;
+ QtFilesPropertyManager* subFilesProperyManager() const;
public Q_SLOTS:
void setValue(QtProperty* property, const QPathComponentAttribute& val);
diff --git a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp
index 70eca8f2..e176f13d 100644
--- a/src/ui/PropertyBrowser/qtworkspaceattribute.cpp
+++ b/src/ui/PropertyBrowser/qtworkspaceattribute.cpp
@@ -62,6 +62,17 @@ void QWorkspaceAttribute::SetTimeStep(const QString& timestep) {
return;
}
+ Timestep* obj = workspace_->GetTimestep();
+ if (nullptr == obj) {
+ workspace_->SetTimestepPath(timestep);
+ return;
+ }
+
+ const QString& path = obj->GetPath();
+ if (path == timestep) {
+ return;
+ }
+
workspace_->SetTimestepPath(timestep);
}