Utils: Make validation async

Changes FancyLineEdit to accept two types of validation functions:

AsyncValidationFunction, which returns a QFuture and takes the new text,
or SynchronousValidationFunction.

Especially PathChooser is changed to use async validation function to
improve snappyness of settings pages that do heavy validation,
for instance the Debugger page.

Change-Id: I1677e7d8acc29e36c69a867850304b7913e6ae7e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-06-29 08:23:45 +02:00
parent 569e73c5ed
commit 83111bb3f6
15 changed files with 350 additions and 213 deletions

View File

@@ -888,6 +888,18 @@ LayoutItem columnStretch(int column, int stretch)
};
}
LayoutItem fieldGrowthPolicy(QFormLayout::FieldGrowthPolicy policy)
{
return [policy](QObject *target) {
if (auto form = qobject_cast<QFormLayout *>(target)) {
form->setFieldGrowthPolicy(policy);
} else {
QTC_CHECK(false);
}
};
}
// Id based setters
LayoutItem id(ID &out)