Line length for QML/JS editing automatic formatting

Adding parameters to functions in the QML/JS formatter
Adding widget and setting to the QML/JS editing settings

Fixes: QTCREATORBUG-23411
Change-Id: Ib9d3ac3b22443e81cd636fbc276c6544dab1511b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Xavier BESSON
2022-04-02 12:15:26 +02:00
parent 4762d54401
commit 87e52ad189
21 changed files with 780 additions and 61 deletions

View File

@@ -28,7 +28,7 @@
#include "qmljstoolsconstants.h"
#include "qmljsindenter.h"
#include <texteditor/simplecodestylepreferences.h>
#include <qmljscodestylepreferences.h>
#include <qmljseditor/qmljseditorconstants.h>
@@ -68,16 +68,19 @@ QString QmlJSCodeStylePreferencesFactory::displayName()
TextEditor::ICodeStylePreferences *QmlJSCodeStylePreferencesFactory::createCodeStyle() const
{
return new TextEditor::SimpleCodeStylePreferences();
return new QmlJSCodeStylePreferences();
}
TextEditor::CodeStyleEditorWidget *QmlJSCodeStylePreferencesFactory::createEditor(
TextEditor::ICodeStylePreferences *preferences,
QWidget *parent) const
{
auto qmlJSPreferences = qobject_cast<QmlJSCodeStylePreferences *>(preferences);
if (!qmlJSPreferences)
return nullptr;
auto widget = new Internal::QmlJSCodeStylePreferencesWidget(parent);
widget->layout()->setContentsMargins(0, 0, 0, 0);
widget->setPreferences(preferences);
widget->setPreferences(qmlJSPreferences);
return widget;
}