blob: 093fc3ff4f492e29e2ad7c0f5b9f6e9fee426999 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmljscodestylesettingswidget.h"
#include "qmljscodestylesettings.h"
#include "qmljstoolstr.h"
#include <utils/layoutbuilder.h>
#include <QSpinBox>
#include <QTextStream>
namespace QmlJSTools {
QmlJSCodeStyleSettingsWidget::QmlJSCodeStyleSettingsWidget(QWidget *parent)
: QWidget(parent)
{
m_lineLengthSpinBox = new QSpinBox;
m_lineLengthSpinBox->setMinimum(0);
m_lineLengthSpinBox->setMaximum(999);
using namespace Layouting;
// clang-format off
Column {
Group {
title(Tr::tr("Other")),
Form {
Tr::tr("&Line length:"), m_lineLengthSpinBox, br,
}
},
noMargin
}.attachTo(this);
// clang-format on
connect(m_lineLengthSpinBox, &QSpinBox::valueChanged,
this, &QmlJSCodeStyleSettingsWidget::slotSettingsChanged);
}
void QmlJSCodeStyleSettingsWidget::setCodeStyleSettings(const QmlJSCodeStyleSettings &settings)
{
QSignalBlocker blocker(this);
m_lineLengthSpinBox->setValue(settings.lineLength);
}
QmlJSCodeStyleSettings QmlJSCodeStyleSettingsWidget::codeStyleSettings() const
{
QmlJSCodeStyleSettings set;
set.lineLength = m_lineLengthSpinBox->value();
return set;
}
void QmlJSCodeStyleSettingsWidget::slotSettingsChanged()
{
emit settingsChanged(codeStyleSettings());
}
} // namespace TextEditor
|