forked from qt-creator/qt-creator
Fix a build with Qt 6
In Qt 6 implicit conversion between QFuture and other types is forbidden. Make it explicit instead. See ff0ba7e2d7b91fd5809cb314935a1ca1a436f6c9. Change-Id: Ie42e6b9b5047ba5eeec9f63fd03179e73f95314d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -183,6 +183,9 @@ public:
|
||||
|
||||
// Blocks until all parsing threads are done. Use for testing only!
|
||||
void test_joinAllThreads();
|
||||
|
||||
template <typename T>
|
||||
void addFuture(const QFuture<T> &future) { addFuture(QFuture<void>(future)); }
|
||||
void addFuture(const QFuture<void> &future);
|
||||
|
||||
QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath);
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
m_futureInterface.setProgressRange(0, MAX_PROGRESS);
|
||||
connect(&m_selfWatcher, &QFutureWatcher<void>::canceled,
|
||||
this, &MapReduceBase::cancelAll);
|
||||
m_selfWatcher.setFuture(futureInterface.future());
|
||||
m_selfWatcher.setFuture(QFuture<void>(futureInterface.future()));
|
||||
}
|
||||
|
||||
void exec()
|
||||
|
@@ -1127,7 +1127,7 @@ void AndroidSdkManagerPrivate::addWatcher(const QFuture<AndroidSdkManager::Opera
|
||||
if (future.isFinished())
|
||||
return;
|
||||
m_activeOperation.reset(new QFutureWatcher<void>());
|
||||
m_activeOperation->setFuture(future);
|
||||
m_activeOperation->setFuture(QFuture<void>(future));
|
||||
}
|
||||
|
||||
void AndroidSdkManagerPrivate::parseCommonArguments(QFutureInterface<QString> &fi)
|
||||
|
@@ -52,6 +52,12 @@ public:
|
||||
|
||||
static ProgressManager *instance();
|
||||
|
||||
template <typename T>
|
||||
static FutureProgress *addTask(const QFuture<T> &future, const QString &title,
|
||||
Utils::Id type, ProgressFlags flags = {}) {
|
||||
return addTask(QFuture<void>(future), title, type, flags);
|
||||
}
|
||||
|
||||
static FutureProgress *addTask(const QFuture<void> &future, const QString &title,
|
||||
Utils::Id type, ProgressFlags flags = {});
|
||||
static FutureProgress *addTimedTask(const QFutureInterface<void> &fi, const QString &title,
|
||||
|
@@ -101,7 +101,6 @@ void CppProjectUpdater::onProjectInfoGenerated()
|
||||
|
||||
QFuture<void> future = CppModelManager::instance()
|
||||
->updateProjectInfo(m_futureInterface, m_generateFutureWatcher.result());
|
||||
QTC_CHECK(future != QFuture<void>());
|
||||
}
|
||||
|
||||
CppProjectUpdaterFactory::CppProjectUpdaterFactory()
|
||||
|
@@ -230,7 +230,7 @@ void GitSubmitEditor::updateFileModel()
|
||||
Core::ProgressManager::addTask(m_fetchWatcher.future(), tr("Refreshing Commit Data"),
|
||||
TASK_UPDATE_COMMIT);
|
||||
|
||||
GitClient::instance()->addFuture(m_fetchWatcher.future());
|
||||
GitClient::instance()->addFuture(QFuture<void>(m_fetchWatcher.future()));
|
||||
}
|
||||
|
||||
void GitSubmitEditor::forceUpdateFileModel()
|
||||
|
@@ -62,14 +62,14 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent) :
|
||||
});
|
||||
|
||||
m_futureSync.setCancelOnWait(true);
|
||||
m_futureSync.addFuture(Utils::onResultReady(SimulatorControl::updateDeviceTypes(), this,
|
||||
&CreateSimulatorDialog::populateDeviceTypes));
|
||||
m_futureSync.addFuture(QFuture<void>(Utils::onResultReady(SimulatorControl::updateDeviceTypes(), this,
|
||||
&CreateSimulatorDialog::populateDeviceTypes)));
|
||||
|
||||
QFuture<QList<RuntimeInfo>> runtimesfuture = SimulatorControl::updateRuntimes();
|
||||
Utils::onResultReady(runtimesfuture, this, [this](const QList<RuntimeInfo> &runtimes) {
|
||||
m_runtimes = runtimes;
|
||||
});
|
||||
m_futureSync.addFuture(runtimesfuture);
|
||||
m_futureSync.addFuture(QFuture<void>(runtimesfuture));
|
||||
populateRuntimes(DeviceTypeInfo());
|
||||
}
|
||||
|
||||
|
@@ -134,9 +134,9 @@ void IosSettingsWidget::onStart()
|
||||
.arg(info.name).arg(info.runtimeName).arg(info.state),
|
||||
Utils::StdErrFormat);
|
||||
} else {
|
||||
futureList << Utils::onResultReady(m_simControl->startSimulator(info.identifier),
|
||||
futureList << QFuture<void>(Utils::onResultReady(m_simControl->startSimulator(info.identifier),
|
||||
std::bind(onSimOperation, info, statusDialog,
|
||||
tr("simulator start"), _1));
|
||||
tr("simulator start"), _1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,12 +167,12 @@ void IosSettingsWidget::onCreate()
|
||||
|
||||
CreateSimulatorDialog createDialog(this);
|
||||
if (createDialog.exec() == QDialog::Accepted) {
|
||||
QFuture<void> f = Utils::onResultReady(
|
||||
QFuture<void> f = QFuture<void>(Utils::onResultReady(
|
||||
m_simControl->createSimulator(
|
||||
createDialog.name(),
|
||||
createDialog.deviceType(),
|
||||
createDialog.runtime()),
|
||||
std::bind(onSimulatorCreate, createDialog.name(), _1));
|
||||
std::bind(onSimulatorCreate, createDialog.name(), _1)));
|
||||
statusDialog->addFutures({ f });
|
||||
statusDialog->exec(); // Modal dialog returns only when all the operations are done or cancelled.
|
||||
}
|
||||
@@ -201,9 +201,9 @@ void IosSettingsWidget::onReset()
|
||||
|
||||
QList<QFuture<void>> futureList;
|
||||
foreach (const SimulatorInfo &info, simulatorInfoList) {
|
||||
futureList << Utils::onResultReady(m_simControl->resetSimulator(info.identifier),
|
||||
futureList << QFuture<void>(Utils::onResultReady(m_simControl->resetSimulator(info.identifier),
|
||||
std::bind(onSimOperation, info, statusDialog,
|
||||
tr("simulator reset"), _1));
|
||||
tr("simulator reset"), _1)));
|
||||
}
|
||||
|
||||
statusDialog->addFutures(futureList);
|
||||
@@ -229,9 +229,9 @@ void IosSettingsWidget::onRename()
|
||||
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
|
||||
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
statusDialog->addMessage(tr("Renaming simulator device..."), Utils::NormalMessageFormat);
|
||||
QFuture<void> f = Utils::onResultReady(m_simControl->renameSimulator(simInfo.identifier, newName),
|
||||
QFuture<void> f = QFuture<void>(Utils::onResultReady(m_simControl->renameSimulator(simInfo.identifier, newName),
|
||||
std::bind(onSimOperation, simInfo, statusDialog,
|
||||
tr("simulator rename"), _1));
|
||||
tr("simulator rename"), _1)));
|
||||
statusDialog->addFutures({f});
|
||||
statusDialog->exec(); // Modal dialog returns only when all the operations are done or cancelled.
|
||||
}
|
||||
@@ -258,9 +258,9 @@ void IosSettingsWidget::onDelete()
|
||||
Utils::NormalMessageFormat);
|
||||
QList<QFuture<void>> futureList;
|
||||
foreach (const SimulatorInfo &info, simulatorInfoList) {
|
||||
futureList << Utils::onResultReady(m_simControl->deleteSimulator(info.identifier),
|
||||
futureList << QFuture<void>(Utils::onResultReady(m_simControl->deleteSimulator(info.identifier),
|
||||
std::bind(onSimOperation, info, statusDialog,
|
||||
tr("simulator delete"), _1));
|
||||
tr("simulator delete"), _1)));
|
||||
}
|
||||
|
||||
statusDialog->addFutures(futureList);
|
||||
@@ -289,10 +289,10 @@ void IosSettingsWidget::onScreenshot()
|
||||
simulatorInfoList.count()), Utils::NormalMessageFormat);
|
||||
QList<QFuture<void>> futureList;
|
||||
foreach (const SimulatorInfo &info, simulatorInfoList) {
|
||||
futureList << Utils::onResultReady(m_simControl->takeSceenshot(info.identifier,
|
||||
futureList << QFuture<void>(Utils::onResultReady(m_simControl->takeSceenshot(info.identifier,
|
||||
generatePath(info)),
|
||||
std::bind(onSimOperation, info, statusDialog,
|
||||
tr("simulator screenshot"), _1));
|
||||
tr("simulator screenshot"), _1)));
|
||||
}
|
||||
|
||||
statusDialog->addFutures(futureList);
|
||||
|
@@ -839,7 +839,7 @@ void IosSimulatorToolHandlerPrivate::requestTransferApp(const QString &appBundle
|
||||
if (SimulatorControl::isSimulatorRunning(m_deviceId))
|
||||
installAppOnSimulator();
|
||||
else
|
||||
futureList << Utils::onResultReady(simCtl->startSimulator(m_deviceId), onSimulatorStart);
|
||||
futureList << QFuture<void>(Utils::onResultReady(simCtl->startSimulator(m_deviceId), onSimulatorStart));
|
||||
}
|
||||
|
||||
void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
|
||||
@@ -875,7 +875,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
|
||||
if (SimulatorControl::isSimulatorRunning(m_deviceId))
|
||||
launchAppOnSimulator(extraArgs);
|
||||
else
|
||||
futureList << Utils::onResultReady(simCtl->startSimulator(m_deviceId), onSimulatorStart);
|
||||
futureList << QFuture<void>(Utils::onResultReady(simCtl->startSimulator(m_deviceId), onSimulatorStart));
|
||||
}
|
||||
|
||||
void IosSimulatorToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, int timeout)
|
||||
@@ -928,7 +928,7 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator()
|
||||
|
||||
isTransferringApp(m_bundlePath, m_deviceId, 20, 100, "");
|
||||
auto installFuture = simCtl->installApp(m_deviceId, Utils::FilePath::fromString(m_bundlePath));
|
||||
futureList << Utils::onResultReady(installFuture, onResponseAppInstall);
|
||||
futureList << QFuture<void>(Utils::onResultReady(installFuture, onResponseAppInstall));
|
||||
}
|
||||
|
||||
void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs)
|
||||
@@ -991,11 +991,11 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
|
||||
}
|
||||
};
|
||||
|
||||
futureList << Utils::onResultReady(
|
||||
futureList << QFuture<void>(Utils::onResultReady(
|
||||
simCtl->launchApp(m_deviceId, bundleId, debugRun, extraArgs,
|
||||
captureConsole ? stdoutFile->fileName() : QString(),
|
||||
captureConsole ? stderrFile->fileName() : QString()),
|
||||
onResponseAppLaunch);
|
||||
onResponseAppLaunch));
|
||||
}
|
||||
|
||||
bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::ResponseData &responseData)
|
||||
|
@@ -130,8 +130,9 @@ void SimulatorInfoModel::requestSimulatorInfo()
|
||||
return; // Ignore the request if the last request is still pending.
|
||||
|
||||
m_fetchFuture.clearFutures();
|
||||
m_fetchFuture.addFuture(Utils::onResultReady(SimulatorControl::updateAvailableSimulators(),
|
||||
this, &SimulatorInfoModel::populateSimulators));
|
||||
m_fetchFuture.addFuture(QFuture<void>(Utils::onResultReady(
|
||||
SimulatorControl::updateAvailableSimulators(),
|
||||
this, &SimulatorInfoModel::populateSimulators)));
|
||||
}
|
||||
|
||||
void SimulatorInfoModel::populateSimulators(const SimulatorInfoList &simulatorList)
|
||||
|
@@ -312,7 +312,7 @@ void BaseFileFind::runSearch(SearchResult *search)
|
||||
search->finishSearch(watcher->isCanceled());
|
||||
});
|
||||
watcher->setFuture(executeSearch(parameters));
|
||||
FutureProgress *progress = ProgressManager::addTask(watcher->future(),
|
||||
FutureProgress *progress = ProgressManager::addTask(QFuture<void>(watcher->future()),
|
||||
tr("Searching"),
|
||||
Constants::TASK_SEARCH);
|
||||
connect(search, &SearchResult::countChanged, progress, [progress](int c) {
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
const QFuture<Result> future = Utils::runAsync(stackSize, m_runner);
|
||||
m_futureWatcher.setFuture(future);
|
||||
|
||||
return future;
|
||||
return QFuture<void>(future);
|
||||
}
|
||||
|
||||
void preventFinalization() final
|
||||
|
Reference in New Issue
Block a user