forked from qt-creator/qt-creator
WebAssembly: Use the more compact layouter function
... and delay the first update until all ui elements are present. Change-Id: Ica996c3262caed9397a951633b0971d48c7c683f Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ WebAssemblySettings::WebAssemblySettings()
|
|||||||
|
|
||||||
connect(this, &Utils::AspectContainer::applied, &WebAssemblyToolChain::registerToolChains);
|
connect(this, &Utils::AspectContainer::applied, &WebAssemblyToolChain::registerToolChains);
|
||||||
|
|
||||||
setLayouter([this](QWidget *widget) {
|
setLayouter([this] {
|
||||||
auto instruction = new QLabel(
|
auto instruction = new QLabel(
|
||||||
Tr::tr("Select the root directory of an installed %1. "
|
Tr::tr("Select the root directory of an installed %1. "
|
||||||
"Ensure that the activated SDK version is compatible with the %2 "
|
"Ensure that the activated SDK version is compatible with the %2 "
|
||||||
@@ -96,7 +97,7 @@ WebAssemblySettings::WebAssemblySettings()
|
|||||||
|
|
||||||
// _clang-format off
|
// _clang-format off
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
Column {
|
Column col {
|
||||||
Group {
|
Group {
|
||||||
title(Tr::tr("Emscripten SDK path:")),
|
title(Tr::tr("Emscripten SDK path:")),
|
||||||
Column {
|
Column {
|
||||||
@@ -113,12 +114,17 @@ WebAssemblySettings::WebAssemblySettings()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
m_qtVersionDisplay,
|
m_qtVersionDisplay,
|
||||||
}.attachTo(widget);
|
};
|
||||||
// _clang-format on
|
// _clang-format on
|
||||||
|
|
||||||
updateStatus();
|
|
||||||
connect(emSdk.pathChooser(), &Utils::PathChooser::textChanged,
|
connect(emSdk.pathChooser(), &Utils::PathChooser::textChanged,
|
||||||
this, &WebAssemblySettings::updateStatus);
|
this, &WebAssemblySettings::updateStatus);
|
||||||
|
|
||||||
|
// updateStatus() uses m_emSdkEnvGroupBox which only exists
|
||||||
|
// after this here emerges. So delay the update a bit.
|
||||||
|
QTimer::singleShot(0, this, &WebAssemblySettings::updateStatus);
|
||||||
|
|
||||||
|
return col;
|
||||||
});
|
});
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
@@ -131,6 +137,8 @@ void WebAssemblySettings::updateStatus()
|
|||||||
const Utils::FilePath newEmSdk = emSdk.pathChooser()->filePath();
|
const Utils::FilePath newEmSdk = emSdk.pathChooser()->filePath();
|
||||||
const bool sdkValid = newEmSdk.exists() && WebAssemblyEmSdk::isValid(newEmSdk);
|
const bool sdkValid = newEmSdk.exists() && WebAssemblyEmSdk::isValid(newEmSdk);
|
||||||
|
|
||||||
|
QTC_ASSERT(m_emSdkVersionDisplay, return);
|
||||||
|
QTC_ASSERT(m_emSdkEnvGroupBox, return);
|
||||||
m_emSdkVersionDisplay->setVisible(sdkValid);
|
m_emSdkVersionDisplay->setVisible(sdkValid);
|
||||||
m_emSdkEnvGroupBox->setEnabled(sdkValid);
|
m_emSdkEnvGroupBox->setEnabled(sdkValid);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user