Skip to content

Commit

Permalink
Fix deprecated Qt API usages. (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMBallard authored Jan 17, 2025
1 parent 22be253 commit 7419c66
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@ QFuture<DynamicEntityDataSourceInfo*> CustomDataSource::onLoadAsync()
dynamicEntityDataSourceInfo->setSpatialReference(SpatialReference::wgs84());

// Return the QFuture<DynamicEntityDataSourceInfo*>
return QtFuture::makeReadyFuture(dynamicEntityDataSourceInfo);
return QtFuture::makeReadyValueFuture(dynamicEntityDataSourceInfo);
}

// Override the virtual onConnectAsync method to define what the DynamicEntityDataSource will do when the data source is connected
QFuture<void> CustomDataSource::onConnectAsync()
{
m_watcher.setFuture(QtConcurrent::run([this](){observationProcessLoopAsync();}));
return QtFuture::makeReadyFuture();
return QtFuture::makeReadyVoidFuture();
}

// Override the virtual onDisconnectAsync method to define what the DynamicEntityDataSource will do when the data source is disconnected
QFuture<void> CustomDataSource::onDisconnectAsync()
{
m_watcher.cancel();
m_watcher.waitForFinished();
return QtFuture::makeReadyFuture();
return QtFuture::makeReadyVoidFuture();
}

// This method runs asynchronously to step through the accompanying .json file and call addObservation(geometry, attributes) with each line
void CustomDataSource::observationProcessLoopAsync()
{
while (!m_textStream.atEnd() && !m_watcher.isCanceled())
{
{
const QString line = m_textStream.readLine();
const QJsonObject jsonObject = QJsonDocument::fromJson(line.toUtf8()).object();

Expand Down

0 comments on commit 7419c66

Please sign in to comment.