Skip to content

Commit

Permalink
Gui: propertyeditor: add setPropertyValue with std::string argument
Browse files Browse the repository at this point in the history
  • Loading branch information
3x380V authored and wwmayer committed Nov 27, 2024
1 parent 7c2acdb commit a80c87c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Gui/propertyeditor/PropertyItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ void PropertyItem::setPropertyName(const QString& name, const QString& realName)
displayText = str;
}

void PropertyItem::setPropertyValue(const QString& value)
void PropertyItem::setPropertyValue(const std::string& value)
{
// Construct command for property assignment in one go, in case of any
// intermediate changes caused by property change that may potentially
Expand Down Expand Up @@ -631,8 +631,7 @@ void PropertyItem::setPropertyValue(const QString& value)
continue;
}

ss << parent->getPropertyPrefix() << prop->getName() << " = " << value.toUtf8().constData()
<< '\n';
ss << parent->getPropertyPrefix() << prop->getName() << " = " << value << '\n';
}

std::string cmd = ss.str();
Expand All @@ -655,6 +654,11 @@ void PropertyItem::setPropertyValue(const QString& value)
}
}

void PropertyItem::setPropertyValue(const QString& value)
{
setPropertyValue(value.toStdString());
}

QVariant PropertyItem::dataProperty(int role) const
{
if (role == Qt::ForegroundRole && linked) {
Expand Down
1 change: 1 addition & 0 deletions src/Gui/propertyeditor/PropertyItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class GuiExport PropertyItem: public QObject, public ExpressionBinding
protected:
PropertyItem();

void setPropertyValue(const std::string& value);
virtual QVariant displayName() const;
virtual QVariant decoration(const QVariant&) const;
virtual QVariant toolTip(const App::Property*) const;
Expand Down

0 comments on commit a80c87c

Please sign in to comment.