Commit e87974a4 authored by Volker Krause's avatar Volker Krause
Browse files

Allow to change the source name after construction

Needed for QML, where we don't have ctor arguments.
parent 0ad1755e
......@@ -32,7 +32,6 @@ AbstractDataSourcePrivate::~AbstractDataSourcePrivate()
AbstractDataSource::AbstractDataSource(const QString &name, AbstractDataSourcePrivate* dd) :
d_ptr(dd ? dd : new AbstractDataSourcePrivate)
{
Q_ASSERT(!name.isEmpty());
d_ptr->name = name;
}
......@@ -46,6 +45,11 @@ QString AbstractDataSource::name() const
return d_ptr->name;
}
void AbstractDataSource::setName(const QString& name)
{
d_ptr->name = name;
}
void AbstractDataSource::load(QSettings *settings)
{
Q_UNUSED(settings);
......
......@@ -112,6 +112,13 @@ protected:
*/
explicit AbstractDataSource(const QString &name, AbstractDataSourcePrivate *dd = nullptr);
/*! Set the name of this data source.
* The name should not change at runtime, this is only provided
* for enabling QML API for generic sources.
* @see name()
*/
void setName(const QString &name);
///@cond internal
class AbstractDataSourcePrivate* const d_ptr;
///@endcond
......
......@@ -65,6 +65,7 @@ public:
void store(QSettings *settings) override;
void reset(QSettings *settings) override;
using AbstractDataSource::setName;
private:
Q_DECLARE_PRIVATE(PropertyRatioSource)
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment