diff options
author | hjk <hjk@qt.io> | 2023-05-31 09:38:24 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-05-31 13:39:37 +0000 |
commit | 8b848df8583c174d48bd30ea2397b4ebd2218c1b (patch) | |
tree | 836d4eb38d112c3a819ddf49d829e0f7492bbda4 /src/plugins/webassembly | |
parent | 95b4da9ba98f6fec624b8d8aee9fae58211668d6 (diff) |
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>
Diffstat (limited to 'src/plugins/webassembly')
-rw-r--r-- | src/plugins/webassembly/webassemblysettings.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/webassembly/webassemblysettings.cpp b/src/plugins/webassembly/webassemblysettings.cpp index 1af1d30c91..fb9293f2c8 100644 --- a/src/plugins/webassembly/webassemblysettings.cpp +++ b/src/plugins/webassembly/webassemblysettings.cpp @@ -20,6 +20,7 @@ #include <QGroupBox> #include <QTextBrowser> +#include <QTimer> using namespace Utils; @@ -66,7 +67,7 @@ WebAssemblySettings::WebAssemblySettings() connect(this, &Utils::AspectContainer::applied, &WebAssemblyToolChain::registerToolChains); - setLayouter([this](QWidget *widget) { + setLayouter([this] { auto instruction = new QLabel( Tr::tr("Select the root directory of an installed %1. " "Ensure that the activated SDK version is compatible with the %2 " @@ -96,7 +97,7 @@ WebAssemblySettings::WebAssemblySettings() // _clang-format off using namespace Layouting; - Column { + Column col { Group { title(Tr::tr("Emscripten SDK path:")), Column { @@ -113,12 +114,17 @@ WebAssemblySettings::WebAssemblySettings() }, }, m_qtVersionDisplay, - }.attachTo(widget); + }; // _clang-format on - updateStatus(); connect(emSdk.pathChooser(), &Utils::PathChooser::textChanged, 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(); @@ -131,6 +137,8 @@ void WebAssemblySettings::updateStatus() const Utils::FilePath newEmSdk = emSdk.pathChooser()->filePath(); const bool sdkValid = newEmSdk.exists() && WebAssemblyEmSdk::isValid(newEmSdk); + QTC_ASSERT(m_emSdkVersionDisplay, return); + QTC_ASSERT(m_emSdkEnvGroupBox, return); m_emSdkVersionDisplay->setVisible(sdkValid); m_emSdkEnvGroupBox->setEnabled(sdkValid); |