@@ -37,7 +37,7 public: | |||||
37 | * Sets the structure of a data source. The controller takes ownership of the structure. |
|
37 | * Sets the structure of a data source. The controller takes ownership of the structure. | |
38 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
38 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
39 | * controller. If it is invalid, the method has no effect. |
|
39 | * controller. If it is invalid, the method has no effect. | |
40 | * @param dataSourceItem the structure of the data source |
|
40 | * @param dataSourceItem the structure of the data source. It must be not null to be registered | |
41 | * @sa registerDataSource() |
|
41 | * @sa registerDataSource() | |
42 | */ |
|
42 | */ | |
43 | void setDataSourceItem(const QUuid &dataSourceUid, |
|
43 | void setDataSourceItem(const QUuid &dataSourceUid, |
@@ -49,6 +49,12 QUuid DataSourceController::registerDataSource(const QString &dataSourceName) no | |||||
49 | void DataSourceController::setDataSourceItem( |
|
49 | void DataSourceController::setDataSourceItem( | |
50 | const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept |
|
50 | const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept | |
51 | { |
|
51 | { | |
|
52 | if (!dataSourceItem) { | |||
|
53 | qCWarning(LOG_DataSourceController()) | |||
|
54 | << tr("Data source item can't be registered (null item)"); | |||
|
55 | return; | |||
|
56 | } | |||
|
57 | ||||
52 | if (impl->m_DataSources.contains(dataSourceUid)) { |
|
58 | if (impl->m_DataSources.contains(dataSourceUid)) { | |
53 | // The data provider is implicitly converted to a shared_ptr |
|
59 | // The data provider is implicitly converted to a shared_ptr | |
54 | impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem))); |
|
60 | impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem))); |
General Comments 0
You need to be logged in to leave comments.
Login now