Android: Use LayoutBuilder for JLSSettingsWidget

Change-Id: Ied43a275d142da44fedb31e52bb1b441b21df3d5
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Alessandro Portale
2024-05-02 16:06:35 +02:00
parent 00654cd4bd
commit 18e12d4fe6

View File

@@ -19,12 +19,12 @@
#include <qtsupport/qtkitaspect.h> #include <qtsupport/qtkitaspect.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/layoutbuilder.h>
#include <utils/mimeconstants.h> #include <utils/mimeconstants.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/temporarydirectory.h> #include <utils/temporarydirectory.h>
#include <utils/variablechooser.h> #include <utils/variablechooser.h>
#include <QGridLayout>
#include <QLineEdit> #include <QLineEdit>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@@ -57,26 +57,23 @@ JLSSettingsWidget::JLSSettingsWidget(const JLSSettings *settings, QWidget *paren
, m_java(new PathChooser(this)) , m_java(new PathChooser(this))
, m_ls(new PathChooser(this)) , m_ls(new PathChooser(this))
{ {
int row = 0;
auto *mainLayout = new QGridLayout;
mainLayout->addWidget(new QLabel(Tr::tr("Name:")), row, 0);
mainLayout->addWidget(m_name, row, 1);
auto chooser = new VariableChooser(this); auto chooser = new VariableChooser(this);
chooser->addSupportedWidget(m_name); chooser->addSupportedWidget(m_name);
mainLayout->addWidget(new QLabel(Tr::tr("Java:")), ++row, 0);
m_java->setExpectedKind(PathChooser::ExistingCommand); m_java->setExpectedKind(PathChooser::ExistingCommand);
m_java->setFilePath(settings->m_executable); m_java->setFilePath(settings->m_executable);
mainLayout->addWidget(m_java, row, 1);
mainLayout->addWidget(new QLabel(Tr::tr("Java Language Server:")), ++row, 0);
m_ls->setExpectedKind(PathChooser::File); m_ls->setExpectedKind(PathChooser::File);
m_ls->lineEdit()->setPlaceholderText(Tr::tr("Path to equinox launcher jar")); m_ls->lineEdit()->setPlaceholderText(Tr::tr("Path to equinox launcher jar"));
m_ls->setPromptDialogFilter("org.eclipse.equinox.launcher_*.jar"); m_ls->setPromptDialogFilter("org.eclipse.equinox.launcher_*.jar");
m_ls->setFilePath(settings->m_languageServer); m_ls->setFilePath(settings->m_languageServer);
mainLayout->addWidget(m_ls, row, 1);
setLayout(mainLayout); using namespace Layouting;
Form {
Tr::tr("Name:"), m_name, br,
Tr::tr("Java:"), m_java, br,
Tr::tr("Java Language Server:"), m_ls, br,
}.attachTo(this);
} }
JLSSettings::JLSSettings() JLSSettings::JLSSettings()